Click here to Skip to main content
15,891,828 members
Everything / Database Development / SQL Server / SQL Server 2008

SQL Server 2008

SQL-Server-2008

Great Reads

by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
by Mubin M. Shaikh
Create time dimension with 24 hour plus values and time buckets in your data warehouse
by Harmen Brouwer
How to create and deploy a SSRS rendering extension, explained by a functional Zip Rendering extension for SSRS 2005, 2008 (R2) and 2012.
by Tecfield
This tip shows how to rename a database and its MDF and LDF files in SQL Server.

Latest Articles

by Mubin M. Shaikh
Walkthrough of the process for one of the industry best practices to export all SQL tables in Flat file format
by Alaa Ben Fatma
Explore your MMSQL server tables in a professional way
by Mahsa Hassankashi
Best approach for having more secure channel to transfer user information throughout the web
by Mahsa Hassankashi
This article enables you to generate table in any database such as Oracle, SQLServer, MySQL, SQLite, Sybase, etc. just by typing table name and its fields. Then you can use NHibernate facilities to make query for data layer.

All Articles

Sort by Title

SQL Server 2008 

11 May 2012 by Jijutj
HelloI have an SQL query which is used to fetch the user details based on firstname. i.e, for e.g if 'a' is given, the users containing 'a' in their firstname should be listed.Im using the '%' operator in my Like Expression. When im fetching using any string such as 'a', 'ss','123' etc,the...
11 May 2012 by P.Salini
You are getting all records for % and _ because those are wildcard characters in Like operator.To know more go through thishttp://msdn.microsoft.com/en-us/library/ms179859.aspx[^]http://www.w3resource.com/sql/wildcards-like-operator/wildcards-like-operator.php[^]
11 May 2012 by Rockstar_
Hi friend,Keep % and _ in [] brackets defenitly it will come
11 May 2012 by Ranjith Reddy CSE
Dear Friend, Check this website, May be this will be ur Exact solution.http://www.w3schools.com/sql/sql_wildcards.asp[^]
11 May 2012 by VJ Reddy
The solution 1 and 2 are very good and clearly give the answer for including % or _ literal in the search expression. In case you want to enter the % _ in a normal way, for example from a TextBox from user input and then want to construct the filter expression, the following regular...
14 Oct 2013 by Rakshith Kumar
i can create a stored procedure and execute itIt will be likecreate procedure getallelementa(@startletter char(1))asselect * from where left(firstname,1)in(@startletter)Execution of this stored procedure will return you the details of all the customers whose name...
4 Jun 2014 by jeevakumar.T
protected void Page_Load(object sender, EventArgs e) { if (!HttpContext.Current.User.Identity.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } studtid = Request .QueryString...
3 Jan 2015 by Suvendu Shekhar Giri
Change this lineddlcoursename.Text = (cmd.Parameters["@COURSE_ID"].Value).ToString();withddlcoursename.SelectedValue= (cmd.Parameters["@COURSE_ID"].Value).ToString(); Also make sure that you have filled the dropdownlist before this line of code. This is the most possible cause of the...
25 Oct 2012 by Aadhar Joshi
Currently i'm using "Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) Jun 17 2011 00:54:03 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) " version for sql server.I have added danish language registry to...
26 Oct 2012 by Sergey Alexandrovich Kryukov
Please see my comment to the question. As I say, your problem is not described, but you need to use Unicode, and Unicode SQL data types such as NCHAR, NVARCHAR2, NCLOB. Please...
26 Jun 2013 by VIP Venkatesan
Hi Friends, Can anyone solve this query and help me??create proc Sp_DespatchMachine@docno intasselect distinct m.mcidno,m.mcrefno,t.buyercomp,t.buyerfactfrom Tbl_Machine m join Tbl_Asset t on m.mcidno = (select t.machineid from Tbl_Asset t where t.deliveryno=@docno) WHERE...
26 Jun 2013 by Pallavi Waikar
Try this querycreate proc Sp_DespatchMachine@docno intasselect distinct m.mcidno,m.mcrefno,t.buyercomp,t.buyerfactfrom Tbl_Machine m join Tbl_Asset ton m.mcidno = (select top 1 t.machineid from Tbl_Asset t where t.deliveryno=@docno)WHERE t.deliveryno= @docno
26 Jun 2013 by Simon_Whale
I would change your query to this CREATE PROC DespatchMachine @docno INT AS SELECT DISTINCT m.mcidno,m.mcrefno,t.buyercomp,t.buyerfact FROM Tbl_Machine m INNER JOIN Tbl_Asset t ON m.mcidno = t.machineid WHERE t.deliveryno= @docnop.s. Inner Join will only return the...
25 Jun 2013 by VIP Venkatesan
Hi friends,i've 60 columns in my tablei need to select all values except one value.select * from mytable will select all 60 columns.But i need 59 columns only. for example i want to neglect the 60th column value.so i need to write a query likeselect...
21 Jun 2013 by salah9
you need to provide ID or some condition to remove the 60th tableselect * from mytable where mytable.ID=60hope this helps you..
21 Jun 2013 by Mike Meinz
You need to write query like select column1,column2....column59 from mytable.It is a best practice to always name the columns in a query. This helps when new columns are added or old columns are deleted. With SELECT *, a new column recently added to the table would be retrieved and the...
22 Jun 2013 by RedDk
Here you go. This is the sample data from "vvexample(td).txt" (Copy and paste it)1 1 0 1 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 1 1 0 1 02 1 0 1 1 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 0 1 1 0 0 1 0 0 1 0 1 1 0 1 0 1 1 03 1 0 1 1 1 1 0 1 1 1 0 0 0 0...
24 Jun 2013 by Adarsh chauhan
Hi,better you select columns in the traditional way like select col1,col2,.... from table(as it will be faster then the SP below)oryou can try following sp,Create PROCEDURE [dbo].[TEST] @Schema varchar(10), @Table varchar(20), @ColumnExclude Varchar(20),...
25 Jun 2013 by gvprabu
Hi...Check the below sample Query.-- Table CreationCREATE TABLE Test(Col1 INT,Col2 INT,Col3 INT,Col4 INT,Col5 INT)-- Local variable DeclarationDECLARE @TableName VARCHAR(100), @SqlQuery NVARCHAR(1000), @ExcludeColPos INT-- Assign default valuesSELECT...
19 Jun 2013 by VIP Venkatesan
Hi Friends,Please solve this Query create proc Sp_test1 @date1 nvarchar(50), @date2 nvarchar(50)as select distinct m.mcidno, CONVERT(VARCHAR(10),h.hdate,103)as hdate from Tbl_Machine m inner join Tbl_History h on m.mcidno=h.mcidno where h.hdate between @date1 and...
19 Jun 2013 by kapil.sharmaA3
Hi Dear Please change your 103 conversion Code to 120 , and increase varchar(10) to 20as like this example :select CONVERT(VARCHAR(19),GETDATE(),120)
19 Jun 2013 by Stephen Hewison
Are you sure the culture details are correct within SQL?If the date format for the culture is wrong then it could be trying to find the 20th month of the year.Try writing your params like this '20 Jun 2013' and see if you still get the problem.
19 Jun 2013 by Mukesh Ghosh
Use This convert(datetime, @date1, 103) if you are using SQL SERVERLike in you case something likereate proc Sp_test1 @date1 nvarchar(50), @date2 nvarchar(50)as select distinct m.mcidno,convert(datetime,h.hdate, 103) as hdate from Tbl_Machine m inner join Tbl_History h on...
19 Jun 2013 by Aarti Meswania
change in spAlter proc Sp_test1@date1 datetime,@date2 datetimeasselect distinct m.mcidno, CONVERT(VARCHAR(10),h.hdate,103)as hdatefrom Tbl_Machine m inner join Tbl_History hon m.mcidno=h.mcidnowhere h.hdate between @date1 and @date2Executionexec Sp_test1 '2013/05/06',...
18 Jun 2012 by Nikil0012
HelloI have created code for creating a .csv file in sql server stored procedure.Now the file is written in my d drive.Now the file is coming correctly till 10 may 2012 and after that the .csv is not coming in my d drive.can some one suggest me the reason and solution for this.
14 Jul 2012 by jschell
Possible reasons.- The stored proc did not return any data and because there is no data the file was not written.- The file was written but somehow it got deleted.- There was an error when the write was attempted by the proc but the proc was not written to account for that possibility so...
15 Jun 2012 by Rick Bassham
How to use the SqlChangeMonitor with the new MemoryCache class in .NET 4.0.
9 Apr 2013 by suraj bhakta01
I have created a window form for login, where user can login with an id and password. After authentication the user can move to the Select_Company form. From there the user select the company and branch and moves to transaction window form.On initial login the user properly logged in and...
9 Apr 2013 by V.
Honestly, I think you need to redesign your application, you're not using different layers and are creating database connection all over the place. I propose you redesign to a DAL - BL - GUI layered approach before addressing any further problems. in The Business Layer (BL) you can then keep a...
9 Apr 2013 by _Maxxx_
The codefrmLogin Login = new frmLogin(); Login.ShowDialog(); if (Login.pAccept) { frmSelectCompany SelectCompany = new frmSelectCompany(); ...
29 Aug 2013 by ananth2012
Hi to all, i am getting following error while connecting to server,A network-related specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow...
29 Aug 2013 by Anh Nguyen Trong
I got the same error.Please update SQL Service Pack 2. The problem will be solved.
14 Mar 2014 by Nikita D. Sinelnikov
HowTo: make the report background (elements) of Microsoft .NET Report (.rdlc) non-printable
1 Nov 2012 by NayakMamuni
Hi,I want to create a table in sql server 2008 with 4 columns i.e MemberId,MemberName,MemberAge and MemberAddress. My requirement is that i want the MemberId column to be autogenerate 16 digit random number.How can I do it ?
1 Nov 2012 by Corporal Agarn
select CAST(round(RAND()*10000000000000000,0) AS BIGINT)I would suggest looking up the following in BOL:CASTROUNDRANDBIGINT
21 Aug 2012 by pranathis012
SELECT *FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=E:\x\Excel.xls;IMEX=1', 'SELECT * FROM [Sheet1$]')error:The 32-bit OLE DB provider "Microsoft.Jet.OLEDB.4.0" cannot be loaded in-process on a 64-bit SQL Server.what is the...
21 Aug 2012 by Mehdi Gholam
64bit OLEDB is not supported, read the following : http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/d5b29496-d6a1-4ecf-b1a4-5550d80b84b6[^]
13 Jun 2011 by Ccsnow
My asp code,SqlParameter[] paramdizi2 = new SqlParameter[3]{ new SqlParameter("@UserId";,SqlDbType.UniqueIdentifier), new SqlParameter("@RolId";,SqlDbType.UniqueIdentifier), new SqlParameter("@Sonuc";,SqlDbType.Int)}; paramdizi2[0].Value = new Guid(TxtUserId.Text);...
13 Jun 2011 by Ra-one
Put @Sonuc INT Output in your stored provedures parameter listYour procedure should be likeALTER proc [dbo].[RolDuzenle](@UserId uniqueidentifier,@RolId uniqueidentifier,@Sonuc INT Output)asDeclare @KayitKontrol intSet @KayitKontrol=(select count(*) from...
12 Jun 2013 by rajeeshsays
I have cursor opened state ,I tried to retrieve the number rows in it through @@CURSOR_ROWS,it gives -1,how can solve this problem. pls help me
12 Jun 2013 by skydger
You should use FETCH NEXT FROM ;The cursor returns a total number of rows when it fully populated. Otherwise you may get a different result. Please see @@CURSOR_ROWS (Transact-SQL)[^] for detailsupd.I suppose that you are getting this beacause of asynchronous...
16 Oct 2013 by Rakshith Kumar
well i still dint get ur entire point. If u want enddate to be greater than start date then you will need to use check constraintcreate table cus(name varchar(max),address varchar(max),startdate date,enddate date constraint chk_date check(enddate>getdate()),status varchar(6)...
16 Oct 2013 by Rakshith Kumar
Finally i seem to have got what exactly you wanted. You can do what you actually wanted this waycreate table cus(cusname varchar(max),address varchar(max),startdate date,enddate date,status varchar(8));After that create a trigger for insert which is like thiscreate...
1 Oct 2013 by write2varun
Hi, I have a Report created in SQl Server 2008 r2,in which i'm passing 3 parameter to the querythe third one is calculated on the basis of other twowhen the there is no data in first two fields there is no data then the third field is disable but when the value is inserted in the...
11 Sep 2014 by _Asif_
Try thisdeclare @TBL TABLE( GROUPID INT, GENERALID VARCHAR(10), [VALUES] DECIMAL(10, 2));INSERT INTO @TBL(GROUPID, GENERALID, [VALUES])SELECT 3,'11111',1.1UNION ALL SELECT 3,'22222',2.2UNION ALL SELECT 3,'33333',3.3UNION ALL SELECT 3,'44444', 4.4UNION ALL SELECT...
11 Sep 2014 by kalaivanan from Bangalore, India
GroupId GeneralId values3 11111 1.13 22222 2.23 33333 3.33 44444 4.42 55555 5.52 66666 ...
19 Apr 2011 by RDBurmon
Hello ,We have SQL server on our remote server .Configuration is like :TCP/IP protocol is enable.SQL service runing from network service.When i tried to access this server from my local box with correct user name and password then it shown me instance not found error.but when...
14 Feb 2011 by #realJSOP
Make sure it's configured to allow remote access.
14 Feb 2011 by Nish Nishant
Perhaps there's a firewall involved? You may have permission to ping it but the sql server port may not be in the allowed list. If so, you may need to configure the firewall to allow incoming connections on the sql server port.See http://support.microsoft.com/kb/287932[^]
14 Feb 2011 by Yusuf
Take alook, may be there is something helpful info for you.Potential causes of the "SQL Server does not exist or access denied" error message[^]You may not be able to connect to an instance of SQL Server that is configured to use the TCP/IP server network library on a computer that is...
22 Aug 2014 by Gurdeep Singh Toor
A Complete Guide to develop aplication using MyGeneration code genration framework. We will develop a Meeting Room Booking web application in this Article.
14 Jun 2012 by Nikil0012
HelloPlz helpI have this code for gridview data bind.I have one row in tableprotected void Page_Load(object sender, EventArgs e) { string connection = "Data Source=ip;Initial Catalog=commonlogin;User ID=sa;Password=; "; ...
14 Jun 2012 by TanvirRaihan
You might have a bound column which is bound to column "RequestID", but that is not in your tbl_SqlImage table
14 Jun 2012 by Sandeep Mewara
Change GridView1.DataSource = ds;to GridView1.DataSource = ds.Tables[0];Make sure all the columns mapped in your grid is present in this table of your dataset used.
23 Sep 2015 by Alberto Venditti
Using a .NET Windows service as an engine for specialized custom plug-ins execution
11 Dec 2009 by Abby Fichtner (Hacker Chick)
A tutorial that walks through adding/updating/deleting data in your database with LINQ to SQL while keeping your class relationships (M:M, 1:M, and M:1) synchronized.
12 Dec 2009 by Abby Fichtner (Hacker Chick)
A beginner's LINQ tutorial that walks you through mapping your SQL Server database tables and relationships to objects, and how to retrieve that data via simple LINQ queries.
11 Dec 2009 by Abby Fichtner (Hacker Chick)
A tutorial and application on using WPF Data Binding with LINQ to SQL classes. This is part 3 of a three-part tutorial on using LINQ to SQL.
22 Aug 2011 by alifaris
Hello everyone,I am working on a project using VS2010 SQL2008 and I saw an ODD behaviour ,First let me tell you that the app runs without any problem in my developing pc (Windows Xp sp3 32bit)But when I was trying the application in another pc (Windows 7 32bit)I got this...
22 Aug 2011 by thatraja
Here more reasons so try those too. Here you goSQL Server 2005 Connectivity Issue Troubleshoot[^]
5 May 2013 by bhaskarareddy
hirefer this linkSolution for a network related and instance specified error[^]
6 Jun 2012 by devsuja
HI,GO START -> ALL PROGRAMS -> SQL SERVER 2008/2005/2008 R2->CONFIGURATION TOOLS->->SELECT SQL SERVER CONFIGURATION MANAGER->SELECT SQL SERVER NETWORK CONFIGURATION->SELECT PROTOCOLS FOR MSSQLSERVER(YOUR INSTANT NAME)->IN RIGHT TASK PANEL->MAKE SURE MENTION BELOW:DISABLE...
19 Sep 2014 by PhyoKyawThuLin
lee bae may loe dae ko may ko loe.min a may sat pat.may loe ma thar
8 Apr 2014 by abdul manan 7
i developed a database using c# and SqlServer 2008 .... i make an exe setup and installed in another computer this time i install sqlexpress edition i import the data file but when i run the application i got the following error..System.Data.SqlClient.SqlException: A network-related or...
9 Apr 2014 by Schatak
The server was not found or was not accessible.To solve the problem, you shouldVerify that the instance name is correct and that SQL Server is configured to allow remote connections.
9 Apr 2014 by Er. Puneet Goel
Get your SQl Instance Name:SQL Server Instance Name :In SQL Server Management Studio->RegisterServers->double click your server to open the Object Explorer -> right click to select the properties window ->General Tab - to see the ServerName (instance name)or Open a new query in...
27 Apr 2011 by Niladri_Biswas
This article will discuss about Copy Column, Derived Column, Character Map and Conditional Split Transformation in SSIS with a palindrome example.
19 Sep 2009 by Paul Rony
A Programmer's Guide to Starting a Software Company and Building an Enterprise Application
10 May 2012 by Alberto Venditti
An alternative to SQL Server Management Studio for scheduling SQL Server Agent jobs
7 Nov 2017 by OriginalGriff
You are rapidly becoming a Help Vampire: and will fail your exams if you do not start doing your own homework very soon. We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor...
23 Dec 2015 by Md. Marufuzzaman
A simple tip/trick to get rows on n’th maximum number from a table
18 Dec 2015 by Md. Marufuzzaman
A simple example of Microsoft SQL Server Pad String
13 Sep 2009 by Md. Marufuzzaman
A simple example of SQL server admin tools.
31 Oct 2016 by Chris Maunder
Timing SQL calls with millisecond accuracy
19 Aug 2009 by Md. Marufuzzaman
This article will give you an idea about how to use CASE expression in T-SQL or as a formula of a particular column.
26 Jul 2009 by AlexS9999
The article provides a simple interface for handling large text in SqlClient and C# file streams.
10 Nov 2013 by Rajat-Indiandotnet
A unique feature of SQL SERVER Loop with Go statement
2 Oct 2013 by Ashwani iOS
I want to install the EXE on the client machines [Windows XP], so do I have to install .NET Framework on that machines too ? My requirement is that without install .NET framework on client's machines ,Clients can run my setup file or exe file and my windows applications in .NET Framework...
2 Oct 2013 by Kumar_Jitendra
Yes you have to install .net framework in your client machine.Regarding .net framework version, you can install 2.0 or 4.0. Both should work.
7 Oct 2013 by Ashwani iOS
Please help me...I want to create setup with database inbuilt.please i want solution but this will show GAC error when i installed in other system...and sql is not installed in that system..plz plz..help me...i want setup build with database through which any one can install freely setup without...
15 Dec 2010 by braju011
hi, This is raju. Here I have a problem with a crystal report viewing. the problem is as follows. I created a stored procedure, in that three select statements are there. When i executing the procedure in sql server it is coming as three tables. But when i see in Field explorer...
15 Dec 2010 by Toniyo Jackson
Check this,http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-stepbystep.htm[^]http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-without-database.htm[^]
20 Dec 2011 by samuel mergia
Hi any one can you help me for sql 2008 which datatype is can use to hyperlink Field i can't findThanks
20 Dec 2011 by Monjurul Habib
You could leverage the new FileStream feature that allows you to store binary large object (BLOB) data as files on the file system without breaking the bond with the row. Moreover, FileStream is also supported by backup and replication processes.The following links will help...
20 Dec 2011 by Wendelius
There's no hyperlink data type in SQL Server. Hyperlink is basically just text and the user interface has the capability to recognize/show/add functionality to this text (such as open the link etc).Depending on your needs you could use either nvarchar[^] or xml[^] to store the hyperlink...
26 Mar 2010 by Singh Ritesh
i want to insert multiple int values selected from dropdown in to a single column seperated by a delimiter(,)along with this values there are some other rows too in which some other values are inserteda table hasBooking id which contain values like 1and roomid which contain values like...
26 Mar 2010 by Sandeep Mewara
ritesh2712 wrote: insert multiple int values selected from dropdown in to a single column Since the comma separated values are selected from a dropdown, form this value in code behind on server side before sending it for SQL update. So it would be INSERT INTO tableBook (BookingId,...
26 Mar 2010 by Abhinav S
You need to normalize your table.Create a new table which now has bookingid and roomid - booking id - roomid-------------------1 - 11 - 21 - 32 - 44and so on...
18 May 2011 by mhwasim
Parse the int values from drop down selection @ FE convert them to another string variable and then pass it to BE query... we are doing this but in reverse order....can u tell how you are passing the values to BE?
25 Mar 2010 by Singh Ritesh
Hi to all im new to sql server 2008Can somebody tell me how to use group by cluase in inner join.I have 4 tables i.e 1)hotelTable which contain cityid and related to 2)city table which contain fields like cityid, stateid,cityName nd 4)statetable which contain stateid,countryid and...
25 Mar 2010 by Christian Graus
Do you not own any books on SQL ? Google not working where you live ? If you have no idea how to even try to do this, why are you trying to ? Did you try this[^] ?You can't use group by to do what you want ( which I am guessing is a list of hotels for each city ) because group by works with...
25 Mar 2010 by Singh Ritesh
thanks for replybut how can i list the hotels for each city as i've to display it on a home page..
25 Mar 2010 by Sandeep Mewara
Followup your one question at one place only. This question does not mean anything for us.Looks like you are talking about this thread of yours:http://www.codeproject.com/answers/68638/About-Sql-Query.aspx[^]referring that thread...ritesh2712 wrote:hotelTable which contain cityid and...
25 Mar 2010 by Christian Graus
If this is homework then you should talk to your teacher for help. I can't imagine what else it could be.
18 Jan 2014 by Petr Ivankov
Application of abstract approach to database domain
3 Feb 2014 by Praveen_P
Hi all I'm developing an asp.net application (i use sql server 2008) .In this at the last page of asp.net application i insert certain values to a remote DB testDB . Also i use a winforms app for accessing testDB and displaying certain values. Every thing goes fine but i need to know is any...
3 Feb 2014 by Florian Trück
Accessing a remote db server is potentially a security risk, as you have to open the ports of the db in the firewall on the server. This opens doors to hackers and script kiddies trying to hack your db server.Consider using webservices like webapi, plain old webservices, WCF or something else...
4 May 2011 by Member 3362773
Hi,I have a requirement to develop a web based mail monitoring tool for a supporting team using asp.net, c#. That tool should have to access Exchange Server (2007 or 2010) mail account by giving mail id and password and get those mails and store those in a SQL Server 2008 database. Can...