2013年9月4日 星期三

mssql general command

W3Schools.com


DBCC (Transact-SQL)

Overview of SQL Query Analyzer


mssql-general-command

Remark : --

Use working Database :  use DataBaseName
List out tables : select * from information_schema.tables;
Data Structure : select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='tablenName'

SP_SPACEUSED  -- can get (name rows reserved data index_size unused)

EXEC SP_SPACEUSED   -- find the size of ms sql server database
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"   --  size of all tables from database

select len('Adeel Fakhar') as length;   -- output 12
select len('Adeel Fakhar''s passion is programming') as length;  -- output 37

select * from [database_server_name].[database_name].dbo.tbl_name -- Query to get data from another database server

沒有留言:

張貼留言