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

SQL Server 2000

SQL-server-2000

Great Reads

by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
by aleksisa
Build a process to import Leads records from Excel into MS CRM via email.
by Md. Marufuzzaman
How easy to read a file without using of the seven extended stored procedures.
by Sven Cipido
How to add a "select all" option to your parameter lists in SQL Reporting.

Latest Articles

by Shivprasad koirala
6 steps to enable transactions in WCF
by Ebenezar John Paul
An Ideal Code Review Checklist that applies for most programming languages
by BharatRamV
Finds the Best Table for a given set of columns
by Mark W Solomon
In this article, I developed a way to determine all the SQL Servers in our environment at will and filter this information into Microsoft's Sunset report for Microsoft SQL Server and present all this information in an SSRS report.

All Articles

Sort by Score

SQL Server 2000 

15 Jan 2013 by Wonde Tadesse
This tip/trick helps to set a default value for blob data type such as Image, VarBinary.
6 Sep 2007 by aleksisa
Build a process to import Leads records from Excel into MS CRM via email.
8 Jul 2010 by Md. Marufuzzaman
How easy to read a file without using of the seven extended stored procedures.
9 Mar 2005 by Sven Cipido
How to add a "select all" option to your parameter lists in SQL Reporting.
26 May 2013 by Tharaka MTR
This post will show you how to fix orphaned SQL users.
4 May 2004 by Daniel Aioanei, Adi Malinaru, Andrei Postolache
An article on how to persist permutations of items in relational databases.
19 Dec 2007 by Bryan Sachdeva
This article describes how to create a wrapper class for the native Phone API, and then uses it to retrieve and store the call history.
9 Jun 2012 by VJ Reddy
The Solution 1 given by Stephen Hewison 2 is good.Alternatively, the following query can be used to Update Status in BLL when the Status is close for all corresponding Batch_Ids in BML table UPDATE BLLSET BLL.Status = 'Close'WHERE BLL.Batch_Id IN ( --List...
7 Dec 2011 by AspDotNetDev
Ask your college about job placement. They often have contacts for internships. Since you have graduated, you won't be doing an internship, but you can still make use of their contacts.Don't be picky. If you are fresh out of college and need experience, why not build it while you are looking...
25 Apr 2012 by Prasad_Kulkarni
Please refer following threads:Beginner SQL Tutorial[^]SQL Server Indexes [^]SQL Server Index Basics[^]Introduction to Indexes in SQL Server[^]A Guide to SQL Server Indexes[^][EDIT]This CP Article will clear all your doubts:Defining Indexes with SQL Server 2005[^]Some...
9 Jun 2012 by Stephen Hewison
I think this will do it:UPDATE BLLSET BLL.Status = 'Close'FROM BLL INNER JOIN (SELECT BML.Batch_Id, FROM BML INNER JOIN BLL ON BML.Batch_Id = BLL.Batch_Id GROUP BY BML.Batch_Id HAVING Count(Distinct BML.Status) = 1 AND MIN(BML.Status) = 'Close')...
18 Dec 2015 by Md. Marufuzzaman
This tip shows you an easy way to split Microsoft SQL Server table row data.
16 Oct 2007 by Adam Page
Setting up an SMS gateway to conduct an SMS survey and storing the survey results in an MS Access database, from which you can generate/print out reports.
10 Nov 2010 by Abdul Quader Mamun
2 Nov 2011 by Gopal Krishna Ranjan
Dear,In that scenario we should use dynamic cursor: - DECLARE @MYVAR NVARCHAR(100)DECLARE MYTESTCURSOR CURSORDYNAMIC FORSELECT MESSAGE FROM ELMAH_ERROROPEN MYTESTCURSORFETCH LAST FROM MYTESTCURSOR INTO @MYVARCLOSE MYTESTCURSORDEALLOCATE MYTESTCURSORSELECT @MYVARThe...
13 Jun 2012 by Stephen Hewison
The reason your second query is not showing a true result is because you're joining the tables without any kind on link. That means that the counts will be multiplied by the other tables. test * usertesting * user1.So if you had the following tables:TableA, TableB, TableC1 6 ...
17 Aug 2012 by ManojKumar19
Update row column with another row column in same table SQL only if it is null.
28 Aug 2012 by akhil khare
Find multiple strings (delimenated by space) in all selected columns.
7 Jun 2013 by Maciej Los
Try this:DECLARE @shortdate VARCHAR(10)--needed to successful conversionSET DATEFORMAT dmy;--your input stringSET @shortdate = '04/13'--valid dateSELECT CONVERT(DATETIME, '01/' + @shortDate) AS myDateMore: SET DATEFORMAT[^]CAST AND CONVERT[^]
15 Mar 2010 by Smithers-Jones
Here is everything you need: SELECT TOP[^]
24 Feb 2011 by khurem
Hello All,We are facing an issue with MS access ADP project (SQL SERVER 2000 on backend) in production environment. Currently 20 users are using the application and they have their own copies of access application, when any user opens the application it creates three new connections with the...
28 Apr 2011 by Mahendra.p25
try this DECLARE @NumStr varchar(1000)SET @NumStr = '100S';BEGINWHILE PATINDEX('%[^0-9]%',@NumStr)> 0SET @NumStr = REPLACE(@NumStr,SUBSTRING(@NumStr,PATINDEX('%[^0-9]%',@NumStr),1),'')ENDPRINT @NumStr
25 Aug 2011 by Abhinav S
This link[^] provides a few different ways to do this.
25 Aug 2011 by Herman<T>.Instance
see here: http://www.petefreitag.com/item/466.cfm[^]this was a 20 second google search
18 Nov 2011 by Amir Mahfoozi
If you want to take a backup from existing database here is a simple TSQL backup command :BACKUP DATABASE [NorthWind] TO DISK = N'c:\backup.dat' WITH NOFORMAT, NOINIT, NAME = N'Northwind Backup'See the syntax here...
7 Dec 2011 by mhamad zarif
When i graduated u stayed without a job for 6 months, and then i found a job and iam so happy now. Dont loose hope, and use google to find jobs.
7 Dec 2011 by Orcun Iyigun
Since you are graduated, if I were you during the job seek process I would strongly recommend building up your portfolio. Most of the work places will ask you if you have any experience or a portfolio to look at. If you have couple of thing to show them, it will be beneficial for you. So maybe...
1 May 2012 by Jean-Francois Lanouette
This is an alternative for "Simple & Advanced Pivots with C# and ASP.NET"
10 May 2012 by Leonardo Paneque
Your line txtTravel_Total_Bill_Amount.Text + "'," need a second ',so it would be txtTravel_Total_Bill_Amount.Text + "','" Might I recommend skipping concatenating string for sql? Because is VERY unsecure. Instead try to use parameters :)
10 May 2012 by Wendelius
Few additional notes.Never concatenate values to a SQL statement. The proper way to keep you secure from SQL injections, type conversion errors and so on is to use SqlParameter[^].Another thing, while the statement is correct, if you specify values for all the columns in correct order,...
10 May 2012 by Sergey Alexandrovich Kryukov
One problem of your code is string concatenation. Repeated concatenation is a bad operation, because strings are immutable, so it's a performance problem. Should I explain why? The class System.Text.StringBuilder and the method String.Format are free from this problem.But much bigger problem...
15 May 2012 by Mohamed Mitwalli
Hi , Check this using ( SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["testConnectionString"].ConnectionString)) { using(SqlCommand cmd = new SqlCommand("SELECT TABLE_NAME FROM...
5 Jun 2012 by bbirajdar
You need to create a SQL server job which will execute periodicallyhttp://msdn.microsoft.com/en-us/library/ms187910.aspx[^]
27 Jun 2012 by Mario Majčica
By using a PATINDEXEX:Declare @Temp Table(Data VarChar(20))Insert Into @Temp Values('BTA200')Insert Into @Temp Values('BTA50')Insert Into @Temp Values('BTA030')Insert Into @Temp Values('BTA')Insert Into @Temp Values('123')Insert Into @Temp Values('X999')Select Data,...
7 Aug 2012 by ManojKumar19
This tip demonstrates how table data can be shared in two stored procedures.
31 Aug 2012 by Wendelius
Typically all the formatting should be done on the client side, not using the database.However, you can use the DATEDIFF function to calculate the difference between to dates and format it as per requirements. For the syntax, see DATEDIFF[^]
5 Sep 2012 by Maciej Los
It should works:SELECT MAX(T.Age) AS MaxOfAgeFROM ( SELECT mark1 AS Age FROM YourTable UNION ALL SELECT mark2 AS Age FROM YourTable UNION ALL SELECT mark3 As Age FROM YourTable) AS TIdea: fetch data from 3 different columns in to one and then get...
20 Sep 2012 by Sreedhar Puligundla
Simple steps to create SQL joins by using SQL Server 2008 Management Studio
11 Dec 2012 by OriginalGriff
Try:SELECT PaperNo FROM StData WHERE Batch LIKE '%A14%'
22 Mar 2013 by snehal harawande
IDENTITY is supported in SQL Server 2000. Please check below linkhttp://msdn.microsoft.com/en-us/library/aa933196(v=sql.80).aspx[^]
14 Aug 2013 by Mehdi Gholam
The first thing you should learn is how to use a search engine.A sample of the results from such an en devour :http://www.w3schools.com/sql/[^]http://www.sqlcourse.com/index.html[^]
14 Aug 2013 by Zoltán Zörgő
0) Forget SQL2000, SQL 2014 ctp is out[^]...1) SQL Server is a software package you can't learn. You could learn to use the aspects/components of it, but to get all the knowledge related to SQL Server... well, that will take a long time, annd will require much work. Look here:...
16 Dec 2013 by Maciej Los
Have a look at example:DECLARE @tmp TABLE(ID INT IDENTITY(1,1), PaymentIn INT, PaymentOut INT)INSERT INTO @tmp (PaymentIn, PaymentOut)VALUES(50000, 0), (0, 2000), (0, 3000), (0, 2500), (0, 2500), (0, 3000), (0, 3000), (0, 2000), (0, 1000), (0, 2000)SELECT t1.ID,...
6 Feb 2014 by Prasad_NC
SELECT (select MAX(myval) from (values (mark1),(mark2),(mark3)) as D(myval)) AS 'MaxMarks' FROM YourTable
19 Oct 2014 by OriginalGriff
Try INSERT INTO SELECT[^]
1 Dec 2014 by Maciej Los
There is a bit difference between char and varchar[^] data types:char [ ( n ) ] Fixed-length, non-Unicode character data with a length of n bytes. n must be a value from 1 through 8,000. The storage size is n bytes. The SQL-2003 synonym for char is character.varchar [ ( n | max ) ] ...
1 Mar 2017 by Bryian Tan
I think, for now, this query should work. SELECT bank, branch, chqno, SUM(Amount) Amount ,STUFF((SELECT ', ' + CAST(ReceiptNo AS VARCHAR(10)) [text()] FROM dbo.code1 WHERE bank = t.bank FOR XML PATH(''), TYPE) .value('.','NVARCHAR(MAX)'),1,2,'...
15 Apr 2010 by Christian Graus
You should consider using google, buying books, and in general showing some ability to do basic research before asking such broad and meaningless questions.
3 Jun 2010 by voloda2
Try this one (replace tab by your table's name):select count(c3), (select count(c3) from tab) from tab group by c3
26 Feb 2011 by Henry Minute
You could do worse than to start with the Teacher Starter Kit[^] from Microsoft.
4 Apr 2011 by OriginalGriff
1) Bring up SQL Server Management Studio.2) Connect, and open the database you want to add the image to.3) Expand the tables, and either add a new table with an appropriate index field, or right click teh table and select design.4) Add a field called "myImage", and make its datatype...
14 Apr 2011 by Sandeep Mewara
I don't want other users to view data from query analyzer and enterprise manager without proper passwordIf the proper password is not there, anyone cannot connect to the database and then won't be able to use the query analyzer or any tool and look data.What else are you looking for?
15 Apr 2011 by Costica U
Try thisselect [Id], [Name] = (select top 1 [Name] from MyTable where [Id] = a.[Id] order by [Name])from ( select distinct [Id] from MyTable ) a
23 Apr 2011 by OriginalGriff
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...For example, I fed your question subject into Google and it suggested this article on this site:Array Parameter Handling in a Stored Procedure[^]Now, why couldn't you...
28 Apr 2011 by anvas kuttan
Declare @S As VarChar(15)Set @S = ' 5000.00/- RS'Select Right(@S, 2) As Rupees, Left(@S, 10) As AmountSelect Substring(@S, 14, 2) As Rupees, Substring(@S, 1, 13) As Amount
4 May 2011 by #realJSOP
I googled "update sql database from excel", and it came up with over 6.3 million results. The very frist one looks like it might be applicable, but since I have no emotional interest in the solution, I'll leave it to your capable hands to sift through the possibilities presented by google and...
17 Aug 2011 by bmckuhen
22 Aug 2011 by mottudeepu
Hai all,I have some doubt.I wish known about Back up and restore in SQL-Server. and i have some questions?1)What is actually backup and restore..?2)What is advantage of Backup..?3)what is happening in backup..?4)What are things which is restoring..?while searching in google i...
29 Aug 2011 by André Kraak
If you take the following meetings for two companies:MeetingID CompanyID Startdate EndDate CountryID StateIDM1 C1 2010-02-01 2010-02-01 2 10M2 C1 2011-08-07 2011-08-07 20 5M3 C2 2011-10-09 2011-10-09 2 10For the...
5 Sep 2011 by Suresh Suthar
If you are using MS SQL Server 2005 and above you can use ROW_NUMBER.Find out more details here.Another link.[^]
5 Sep 2011 by Abhishek Sur
I have one tip posted which lets you select from any range of rows.Check How To Select Record Based on Row Number[^]I hope this will help.
14 Sep 2011 by sachin10d
Use the below functionSyntax:DATEDIFF ( datepart , startdate , enddate )Eg:SELECT DATEDIFF(day, '9/12/2011' ,GETDATE())
17 Oct 2011 by Toniyo Jackson
Try this.SELECT ID, LEFT([Name], LEN([Name]) - 1) as [Name] FROM ( SELECT DISTINCT ID FROM tablename ) AS A OUTER APPLY ( SELECT RTRIM(B.Name) + ' -- ' FROM tablename B WHERE A.ID = B.ID FOR ...
25 Oct 2011 by OriginalGriff
Google would have helped you here: it would have sent you to MSDN. Time to start reading! Introduction to Membership[^]
19 Nov 2011 by OriginalGriff
l.Text = dt.Rows[ctr]["Serial"] + ",";"INDEXOUTOFRANGE EXCEPTION WAS UNHANDLE BY THE USER CODETHERE IS NO ROW POSITION 0(ZERE)"The clue is in the error: There is no row in your table. You do not show where you load the table with anything other than a new table - so there are no rows....
10 Dec 2011 by thatraja
FIX: Error message when you try to retrieve rows from a cursor that uses the OPTION (RECOMPILE) query hint in SQL Server 2005: "Could not complete cursor operation because the table schema changed after the cursor was declared"[^]
2 Jan 2012 by Mehdi Gholam
It is not advisable to do so, create tables in your own database instead.You should not mess around with the system databases especially if you are a beginner.
3 Jan 2012 by Wendelius
Don't quite understand the question. System tables are created by SQL Server installation and other administrative tasks, not by users. Another thing is that you should let the master database to be as it is as Mehdi pointed out. It's no place for user tables. Create a separate database for...
30 Jan 2012 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
There is some mistakes.If you are using Adapter, then no need to do likeaddEmpinfoCommand.ExecuteNonQuery();Remove the above line.Now modify the lineda = new FbDataAdapter();toda = new FbDataAdapter(addEmpinfoCommand);
30 Jan 2012 by Manfred Rudolf Bihy
The error message contains all the information you need:"...This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..."This essentially says that you are targeting a .NET version in your project that is less than the the .NET version the Firebird...
30 Jan 2012 by OriginalGriff
Try:SELECT * FROM information_schema.tables"this is show all table i want to show all database"Oops! :ODim con As New SqlConnection("Data Source=GRIFFPC\SQLEXPRESS;Integrated Security=True")con.Open()Dim cmd As New SqlCommand("sp_databases", con)cmd.CommandType =...
10 Mar 2012 by OriginalGriff
Try:SELECT ROW_NUMBER() OVER (ORDER BY Id) AS RowNum,* FROM myTable
14 Mar 2012 by Herman<T>.Instance
assuming admin1code is of datatype (n)varchar Update Countryset admin1code = right('00'+ admin1code, 2)
11 May 2012 by Sandeep Mewara
Here, have a look at these articlea: MSDN: Creating and Modifying PRIMARY KEY Constraints[^]MSDN: Modifying a Primary Key[^]SQL SERVER – How to Drop Primary Key Contraint[^]
16 May 2012 by uspatel
You can use this in various waysSee herehttp://msdn.microsoft.com/en-us/library/ms189049.aspx[^]If you are using SQL server mgmt studio,Just create database diagram aand make relation ship in tables.It automatically creates relationships.
30 May 2012 by Maciej Los
In MS SQL Server 2000 READPAST, NOLOCK, and READUNCOMMITTED are not allowed.More at: UPDATE (SQL Server 2000)[^]Try to mull over possible approaches to the task with Granting permissions[^] or Using Ownership chains[^].PERMISSIONS[^]GRANT[^]
30 May 2012 by Sandeep Mewara
Here:SQL - How to get the Unique Key's Column Name from Table[^]Something like:select CCU.CONSTRAINT_NAME, CCU.COLUMN_NAMEfrom INFORMATION_SCHEMA.TABLE_CONSTRAINTS as TCinner join INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE as CCU on TC.CONSTRAINT_CATALOG =...
9 Jun 2012 by Yogesh P Patel
I have 2 Tables BLL & BML . I want to update Table (BLL)'s status(Close) if related IDs in Table(BML) have All status Values (Close).Data Structure as below _______________________________Table Name : BLL ==========================Batch_Id ...
9 Jun 2012 by Tim Corey
This error is happening because your SQL command is taking longer than 30 seconds to execute. I would recommend using an asynchronous call to execute this command, since it is running that long. Further, I would recommend that the SQL code be put into a stored procedure so that it can be...
18 Jun 2012 by Prasad_Kulkarni
Yes; google[^]conflict detection in peer-to-peer replication in sql 2008[^]Service Broker Priorities and Diagnostics in sql 2008[^]ADO.NET Data Services in sql server 2008[^]Just check out first 5 links of each search. Always TRY google first then post here if you get stuck'd.
31 Aug 2012 by Mehdi Gholam
Read this : http://social.msdn.microsoft.com/Forums/en/transactsql/thread/5e5a4474-31b8-4316-8a34-1e4a5572fb49[^]
6 Nov 2012 by kankeyan
you need to reseed the identity column. check for the below example.Hope this may help you.If helps Vote it.USE AdventureWorksGO/* Create a table with one identity column */CREATE TABLE TableID (ID INT IDENTITY(1,1), Col VARCHAR(10))GO/* Insert 10 records with first value...
6 Nov 2012 by Eyakem
Here is a quick example, i'll walk you through..1 Lets create a table called UserTable2 insert four rows3 delete the first row (so we are where you are now, a table that starts from ID=2My solution: copy the contents of the table to a temporary table, truncate the origional table and...
14 Nov 2012 by chaau
SELECT Name,SUM(CASE WHEN qty > 1 AND qty 10 AND qty 20 AND qty 30 AND qty
8 Jan 2013 by Prasad_Kulkarni
Check out similar discussion:LINQ Vs StoredProcedure[^]LINQ Vs StoredProcedure[^]Stored Procedures vs LINQ[^]Stored Procedures vs LINQ[^]Also have a look on this articleSpeed up Linq to Sql with compiled queries[^]
22 Jan 2013 by ujju.1
I have a table, say tbl_test with data in following format.tbl_test_____________________Action_Id_____________________123/221/4556/32_____________________5643/990_____________________676_____________________I want the output to split the action id by '/' and show the...
22 Jan 2013 by Tharaka MTR
Check my article below, you just have to modify the delimiter string, if you have any question please let me know.Generating and splitting a delimited string column[^]
8 Feb 2013 by Krunal Rohit
Maybe this will help ya : http://www.aspdotnet-suresh.com/2011/12/jquery-lightbox-image-slideshow-gallary.html[^]
27 Jun 2013 by CHill60
Your question has already been answered here[^]
14 Aug 2013 by ridoy
A simple search in Google[^] would let you all that you need.So first learn how to search there.See..Welcome to SQL[^]SQL Tutorial[^]
17 Sep 2013 by codestar007
See thisinstall-sql-2005-developer-on-windows-8[^]
15 Dec 2013 by thatraja
Check this article & customize itCalculating simple running totals in SQL Server[^]
19 Dec 2013 by Maciej Los
Try this:SELECT DISTINCT StudentId, (SELECT SUM(Total_marks) FROM prePivot1 AS t2 WHERE t2.StudentId = t1.StudentId AND Sub_Abbr = 'ENG') AS [ENG], (SELECT SUM(Total_marks) FROM prePivot1 AS t2 WHERE t2.StudentId = t1.StudentId AND Sub_Abbr = 'MBEN') AS [MBEN], (SELECT...
6 Jan 2014 by thatraja
Why do you want that way? If you choose that way, you can't stop where you want. Better way is do it manually like using some logic based on reference of your data. If still you want to go with your way, check this Tip/TrickReset Table Identity[^]
7 Feb 2014 by OriginalGriff
You don't need to: your "nested" if contains the clause in the outer if as well! So just dump the outer condition...
7 Feb 2014 by Karthik_Mahalingam
try thisif exists (select * from K_RT_AmountReceived where trno=@trno)begin if exists(select *from K_RT_AmountReceived where trno = @trno and recamount = @recamount) begin select '2' as status end else begin ...
20 Aug 2014 by OriginalGriff
Assuming that the two tables are related, you could use a JOIN - but if you mean that you want to INSERT rows to two related tables, then you would probably be better off creating a Stored Procedure to do two inserts within a single Transaction - so if the second fails, it doesn't leave your DB...