Fast Guide: SQL Server 2000 commands

Here are ten commands you need to know!

Here are ten SQL server 2000 commands you need to know!

 

1. This allows you to read ten rows from a table.

select TOP 10 * from TABLE_NAME

2. This is used to show the text for a given stored procedure.

EXECUTE sp_helptext PROCEDURE_NAME

3. This is used to ensure a null field is returned as zero.

select ISNULL(FIELD_NAME, 0) from TABLE_NAME

4. This is used to show all object names in the current database matching a pattern.

select * from sysobjects where name LIKE '%PATTERN%'

5. This is used to show the table definition.

EXECUTE sp_help TABLE_NAME

6. This is used to show all DTS packages that match a pattern.

select distinct name from msdb.dbo.sysobjects where name LIKE '%PATTERN%'

7. This is used to show all constraints for table names in the current database matching a pattern.

 select * from INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE where TABLE_NAME LIKE '%PATTERN%'

8. This is used to run UPDATE STATISTICS against all user-defined tables in the current database.

EXEC sp_updatestats

9. This is used to show all stored procedures in the current database that match a pattern.

select * from sysobjects where xtype = 'P' and name LIKE '%PATTERN%'

10. This is used to ensure an empty string is returned as null.

select NULLIF(FIELD_NAME, '') from TABLE_NAME

 

 

This was first published in June 2006

Glossary

'Fast Guide: SQL Server 2000 commands' is part of the:

View All Definitions

Dig deeper on Microsoft SQL Server 2000

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

File Extensions and File Formats

Powered by:

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close