Friday, March 30, 2012

please help me about list of table

i need to give list all table in my database plaese give me qurity?

thanks a lot

SELECT [name] FROM [sysobjects] WHERE TYPE = 'U'|||SELECT * FROM sysobjects
WHERE type = 'u'
ORDER BY [NAME]|||SELECT * will give you ever column but Its a way better practice to add in every column name that you have. And only use the ones that you need.
|||Rather than select data out of the sysobjects table, which is notguaranteed to be forwards/backwards compatible with different SQLServer versions, I encourage you to use the INFORMATION_SCHEMA.TABLESview, which is supposed to work with each SQL Server version.
SELECT
TABLE_NAME
FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_TYPE = 'BASE TABLE'

No comments:

Post a Comment