Click here to Skip to main content
15,887,027 members
Everything / Database Development / SQL Server / SQL Server 2005

SQL Server 2005

SQL-Server-2005

Great Reads

by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
by Steve Krile
Fully AJAX-enabled user control used to select names from a database in a drop-down format.
by Mubin M. Shaikh
Create time dimension with 24 hour plus values and time buckets in your data warehouse
by Max Paulousky
This article presents the techniques and caveats of building Silverlight applications that can be notified about database state changes via polling duplex. WSHttp binding and CLR triggers are used to implement the solution as well.

Latest Articles

by Narapareddy Shyamprasad
SQL Dynamic Pivots
by Luca Astolfi
User defined procedure for make an HTML table from T-SQL Select statment
by JasonShort
Wouldn’t it be handy if you could use regular expressions (RegEx) in your SQL code?  You could do some really advanced queries through the ability to specify regular expressions rather than just the simple like % matching you normally use. SQL CLR can do that!
by Ebenezar John Paul
An Ideal Code Review Checklist that applies for most programming languages

All Articles

Sort by Title

SQL Server 2005 

5 Feb 2020 by maajanes
"String or binary data would be truncated. The statement has been terminated." Please explain about this exception.
7 Dec 2011 by uspatel
This exception occures when your datatype,size does not match with database field attributes.See Discussion
7 Dec 2011 by koolprasad2003
String or binary data would be truncated Error suggests your Datatype in Database is smaller than inserted value.1. Increase datatype length or decrease length of value before inseration.
3 Mar 2013 by marigold12
when user store data at that time size of data type is less as compared to required data type size then it gives such kind of error solution to increase your data type size...
10 Mar 2014 by SanSkun
Hi, Its the error because of data-type and what the size you are passing for inserting data to that field.Suppose i have declared a field named name varchar[20] and i am trying to inserting name of more than 20 characters then i will get an error like "String or binary data would be...
27 May 2013 by S.Dwaik
i have project used sql2005and when i need to join writeselect * from A ,Bwhere A.ID *= B.ID'( *= )' is no problem in sql2005but in sql2012 is not accept thatwhat i can Do to solve it problem???
27 May 2013 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
This operator is discontinued after version 2005.You can still use it by setting the COMPATIBILITY_LEVEL to 80 in SQL Server 2008 R2.But you can't do it in 2012. There is no way to do this in 2012.Refer - Outer Join Operator (+) - Oracle to SQL Server Migration[^].SolutionInstead...
23 Mar 2017 by Faizymca
I need some help with the following problem:I've been using a MS ReportViewer component in a website for a while now, but recently I've been getting the error shown below.The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both...
7 Oct 2013 by bluesathish
Go to Solution explorer and remove all 'Microsoft.ReportViewer.WebForms references. Then Add the references from your latest directory (VS2008). Go to Build menu and Click clean solution and Click Rebuild solution.Regards,BlueSathish
7 Nov 2015 by Venkat Chaitanya Kanumukula
check this link on the resolution to bind old and new Dll's in the config.http://stackoverflow.com/questions/9429277/problems-with-reportviewer-assemblies-in-vs2010example below ...
23 Mar 2017 by Member 13080469
on web.config review assembly info. appear two times "Microsoft.ReportViewer.WebForms" one with 12.0.0.0 and other with 11.0.0.0. just get one of this.
1 Jun 2012 by samu4u
Unless you have an explicit ORDER BY clause, there is NO implicit ordering (there is no "original order from DB") in a SQL Server environment. mean to say, in a small database of say, 1 Lak of records, it does not preserve insertion order (even though there are no concurrent inserts). Even...
1 Jun 2012 by Maciej Los
Order by may not change order in a database. Yes, it's used only for listing the data.More at: ORDER BY[^]
1 Jun 2012 by Clifford Nelson
This is what I found out:SELECT is a set-oriented operation and, as sets are unordered, no specific order in the resultset is guaranteed, unless you explicitly use ORDER BY.
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',...
7 Feb 2011 by vijay.darji2
I was live my website about a few day ago. It was developed in ASP.Net, C#, and Ms access 2003, SQL server 2005 is used as a database. HTML page is display well, but when we open .aspx page it will not display and giving error. Please somebody help me to sort out this problem
7 Feb 2011 by Parwej Ahamad
Check with your provider, is he providing .Net framework support?
7 Feb 2011 by velmahesh
Check the Code based on Error Message..
15 Jun 2012 by Rick Bassham
How to use the SqlChangeMonitor with the new MemoryCache class in .NET 4.0.
28 Jul 2008 by John Kenedy S.Kom
This project enables developer to create a setup package that automatically installs SQL 2005 Express and restores database to it
6 Aug 2007 by Omar Al Zabir
Learn about 13 production disasters that can bring down your business
26 Nov 2012 by Member 9630032
foreach (GridViewRow rowItem in GridView1.Rows){ CheckBox chk = (CheckBox)(rowItem.Cells[7].FindControl("ch1")); if (chk != null && chk.Checked) { SqlConnection myConnection = new SqlConnection("Data Source=PCIMS051;Initial...
26 Nov 2012 by kishore Rajendran
Try this,foreach (GridViewRow rowItem in GridView1.Rows){CheckBox chk = (CheckBox)(rowItem.Cells[7].FindControl("ch1")); if (chk.Checked==true){SqlConnection myConnection = new SqlConnection("Data Source=PCIMS051;Initial Catalog=unblockingwebsite;Integrated...
26 Nov 2012 by Mohd. Mukhtar
Hi,Update your code as below. foreach (GridViewRow rowItem in GridView1.Rows){ CheckBox chk = (CheckBox)(rowItem.FindControl("ch1")); if (chk != null && chk.Checked) { try { SqlConnection myConnection = new SqlConnection("Data...
25 Nov 2012 by Member 9630032
1cell in a gridview contains 3 checkboxes to pass its value to sql2005 as1,2,3 when update link click
25 Nov 2012 by Member 4129308
Updating link is used to update a Particular row in emp table using Gridview.Double click on RowUpdating Event and write below codeprotected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; CheckBox...
9 Apr 2013 by Sikaman
Hello, I need assistance with combining these separate queries into one. It may be simplistic, but they work. Goal is to replace all 3 with a single query. I suspect the solution may involve nested queries, or subqueries. Or probably even a "join" of some sort. SELECT [PatName] ...
9 Apr 2013 by Nick Fisher (Consultant)
If the leading zeros need trimming, then why not do a basic join and trim the key values in the WHERE statement?select a.MTMRN, a.PatName, a.IDX6, a.ServiceDate, a.ExamName, a.Exam, b.SchedProv, b.SchProvNPI, b.ApptDt, b.ApptDt2, b.ApptTm, b.ApptTm2, b.VisitType,...
10 Apr 2013 by Maciej Los
Solution1 by Nick Fisher looks good now. I think it's very helpful, but i need to point you in the right direction ;)Refer below...
24 Mar 2009 by Shivprasad koirala
4 steps to use readymade DAL component (Data application blocks)
11 Jan 2006 by Petr Palas
Did you know there’s an easier way how to create dynamic web sites? Learn how Kentico CMS for ASP.NET will increase your productivity and help you win more clients.
12 Dec 2011 by akosidab
Hi,I would like to ask your opinion here in CodeProject.I would like to develop 32Bit Applications in Visual Studio 2008 using Windows7 64Bit OS. Would there be a problem if I'm going to deploy my application in a 32Bit OS?Thank you very muchRegards,David
12 Dec 2011 by AmitGajjar
Hi,just make sure Solution Platforms should be "Mixed Platforms".hope this will help you.thanks-amit.
23 May 2007 by Petr Palas
What is a content management system? Does it really work? Why should I use it? How does it help me? This article answers the most common questions developers ask about content management systems (CMS).
4 Oct 2013 by Member 7909353
I have install the sql server business intelligence development studioand when i go to programs\sql server 2005 \sql server business intelligence development studio.when I click but it does not give any response and does not open.
26 Nov 2013 by GDdixit
hi to all ... i want to create an asp.net blog , but i have a problem ...the articles ,topics that user create , he put images , text any where on the page according to his self . then how can i save this data in my database .... or i have to save html source or...
25 Nov 2013 by Vinodh.B
HI Please refer creating a blog in asp.net using C#[^]MArk it as answer if it resolves your problem
5 Feb 2014 by Rashmikants Monpara
Hi friendsi have one gridview and in this gridview i have fetch HeaderText dynamic and my problem is i have create sorting in this dynamic hedertext field but they are not work but without dynamic hedertext are working
28 Apr 2010 by sharmarun
Hi,Can anyone help me? I have created a table and with a primary key called "ID". However, I want the "ID" be auto increment as well.Here is my question, how can I do in the following format:"PIC0001", "PIC0002", "PIC0003", ............ etc.Anyone can help me?
28 Apr 2010 by Sandeep Mewara
We already suggested of how you can achieve it here:Lhttp://www.codeproject.com/Answers/72563/How-To-generate-user-defind-lab-no.aspx#answer1[^]
28 Jun 2010 by Sandeep Mewara
Please dont post multiple times:http://www.codeproject.com/Questions/90234/how-to-create-a-database-connection-in-html-with-s.aspx[^]
29 Jun 2010 by oujeboland
Hi , i want to retrieve an image from database and i wrote codes below . first it worked but i don't know why it gives the error "parameter is not valid".There is 2 probability . the codes to save image to database is incorrect or the retrieving code is wrong. by the way as you see at images...
9 Feb 2012 by murat bayram
what is the solition?i get this error and not find the solition
1 Sep 2012 by Raktotpal
//BROWSE button private void button1_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { textBox1.Text = ofd.FileName; } ...
19 Apr 2011 by RDBurmon
I have two server . between which i need to check referential integrity and other constraint.Like the below example.It will surely descibe the condition and issue.There is two server SERVER1 and SERVER2.SERVER1 having Database DB1and SERVER2 having Database DB2DB1 having table...
19 Apr 2011 by RDBurmon
Hi all,I have one sql query and i need to export result of that query into excel file.I need to automate these task by using job.Please advise me .
23 Jan 2011 by Abhinav S
See http://www.mssqltips.com/tip.asp?tip=1202[^].
1 Feb 2011 by Mohd Wasif
Hi All, I have a table having fields as startdate as datetime and endate as datetime and has records . Now my problem is that I have to check that an input date lies between startdate and endate. and that is equal to startdate or endate.data is likeEmployee name , ...
1 Feb 2011 by Om Prakash Pant
select * from your_table where '01/13/2011' between startdate and enddateORselect * from your_table where '01/13/2011' between CONVERT(VARCHAR(10), startdate, 101) AND CONVERT(VARCHAR(10), enddate, 101)
1 Feb 2011 by Abhinav S
This should do it - select * from mytable where startdate = @mydate
18 Apr 2011 by RDBurmon
In one of my procedure , I am getting XML , Which have node , ProductName , DeliveryDate .In my proceudre It parse the XML and insert into one table which having one NVARCHAR and one Datetime Column.In the XML I am getting the date in format (2011-02-16T11:08:00+05:30)Please let me...
20 Mar 2011 by Sergey Alexandrovich Kryukov
It's good that you failed replacing +05:30 with blank spaces and too bad you tried.This is the time zone. Without the time zone, you have the local time but loose the ability to order different events in time if they happen in different places of the globe. As you noticed +5:30 is not a...
29 Jul 2012 by rorrykeys
A network-related or instance-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 remote connections. (provider: Named Pipes Provider, error: 40...
29 Jul 2012 by jasmin_patel
I think you add to your server name and after then instant name..LikeSERVER_NAME\SQLEXPRESSor if it is local Server then.\SEQEXPRESSin short servername\serverinstantnameThank you.
29 Jul 2012 by Santhosh Kumar Jayaraman
public void store(string a) { SqlConnection connect=null; connect = new SqlConnection("server= localhost\sqlexpress ; initial catalog=Student_Tracker DB ; integrated security= true ;"); connect.Open(); connect = new...
29 Jul 2012 by awaisiq
public void store(string a) { SqlConnection connect=null; connect = new SqlConnection("Data Source= (local) ; initial catalog=Student_TrackerDB ; integrated security= true ;"); connect.Open(); connect = new SqlConnection("insert...
29 Jul 2012 by Mehdi Gholam
If your database name has spaces use brackets around it :connect = new SqlConnection("server= . ; initial catalog=[Student_Tracker DB]; integrated security= true ;");Or remove the space like : Student_Tracker_DB
29 Jul 2012 by rorrykeys
public void store(string a) { SqlConnection connect=null; connect = new SqlConnection("server= servername;initial catalog=Student_Tracker;User Id=userid; password=Password@123"); connect.Open(); SqlCommand cmd = new...
15 Apr 2012 by syed armaan hussain
hi alli am facing a problem .. i hav a button in my web form .. and i want that when i clik this button then a data which i made in sql server 2005 ... will be displayed in a grid view i placed just below the buttoni am doing this with the code i showed u below in image but when i m...
15 Apr 2012 by Kuldeep B
sqldatareader dr=new sqldatareader(cmd);cmd.executereader();datatable dt=new datatable();dt.load(dr);gridview1.datasource=dt;gridview1.databind();
15 Apr 2012 by pravallika tumuluri
SqlConnection con = new SqlConnection("Data Source=armaan-pc;Initial Catalog=ContactsDB;User ID=sa;Password=arman"); SqlCommand cmd = new SqlCommand("select * from contact", con); con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds);...
15 Apr 2012 by sravani.v
Try this:If you receive the following error message There is already an open DataReader associated with this Command which must be closed firstand you are sure that all dataReader are closed the following workaround can help you.The MARS default settings has changed at release RC1, so...
15 Apr 2012 by yogiCsharp
You are using SqlDataAdapter which is used in connectionless architecture so you don't need to write con.open(), try this I am sure it'll workHappy coding :)
16 Apr 2012 by phiasau_congtroi
Nếu bạn muốn thì đây là câu trả lời
11 May 2007 by andrewcates
In an attempt to open DotNetNuke to a wider audience, I have converted the original VB code into C#
2 Jul 2011 by aa8716
Hi all,We all know that DML commands are Data manipulation commands in DBMS.DML commands: used for data manipulations in database tables.SELECTDELETEUPDATEINSERTwhy the SELECT Command is categorised into DML When We know that it is just used to select data from...
2 Jul 2011 by CS1401
Most developers think of SQL in terms of the DML-Data Manipulation Language: the Delete, Insert, Update and particularly the Select statements. And truly Select provides a lot of retrieval power with joins to other tables, grouping, nested subselects and other retrieval goodies. Again, it is...
2 Jul 2011 by Ramakrishna Alla
Actually Select is not a part of DML but CRUD(C-Create/Insert,R-Read/Select,U-Update,D-Delete)Select Command is belongs DRL(Data Retreival Language)-(It doesn't affect on state of DB (here state indicates number of rows affected))-so We also call Select as Non action query.DML - Insert...
2 Jul 2011 by aa8716
Hi Ramakrishna Alla,You have made very good classification of DML commands depending on thier action on database table.Thank You for Sharing your answer...
19 Sep 2005 by msalmank
A quick hands-on application to guide you in using paneled forms, multi-splash screens, SQL Express, and many more....
10 Sep 2004 by Mark Brandon
A helper object library to automate migration of SQL RS items from development to production servers.
28 Jun 2008 by Simon Gulliver
A lighweight approach to creating AJAX.NET-enabled grids, with advanced functionality built in.
27 Jan 2011 by honey4bee
A local variable named 'Status' cannot be declared in this scope because it would give a different meaning to 'Status' , which is already used in a 'parent or current' scope to denote something else
27 Jan 2011 by Sergey Alexandrovich Kryukov
Just rename it. Mind visibility and scope. Not sure what is that? — just rename it.—SA
27 Jan 2011 by Pravin Patil, Mumbai
bool status = true;if (status == true){ for (int status = 0; status
9 Mar 2011 by santosh poojari
This article will provide the first step towards migrating error free dtsx package to higher version of sql server ssis
5 Jun 2007 by Fadrian Sudaman
This article shows how to easily extend the GridView to support custom paging and remove the restriction of using ObjectDataSource as the data source.
22 Jul 2008 by Mike Borozdin
Tutorial on using LINQ, ListView, LinqDataSource, DataPager, ASP.NET AJAX
19 Sep 2009 by Paul Rony
A Programmer's Guide to Starting a Software Company and Building an Enterprise Application
20 Mar 2006 by Naveen Karamchetti
This article describes the new functoids in BizTalk Server 2006.
11 Dec 2012 by Patel Shailendra
create function Age(@date datetime)returnasbegin DECLARE @tmpdate datetime, @years int, @months int, @days int, @age varchar(12)-- declare @date datetime-- set @date='12/29/04' SELECT @tmpdate = @date SELECT @years = DATEDIFF(yy, @tmpdate, GETDATE()) - CASE WHEN...
11 Dec 2012 by Dain Ucak
you need to improve your query.change your return statement like returns [datatype]i changed itcreate function Age(@date datetime)returns datetime-- your problem was hereasbeginDECLARE @tmpdate datetime, @years int, @months int, @days int, @age varchar(12)-- declare @date...
11 Dec 2012 by OriginalGriff
You need to declare the return type of your function:create function Age(@date datetime)RETURNS VARCHAR(12)as
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