

Rebuild All Database Indexes
You can rebuild all indexes present in your database with the following query: EXEC sp_MSforeachtable @command1=”print ‘?’ DBCC DBREINDEX (‘?’, ‘ ‘, 80)” GO EXEC sp_updatestats GO
You can rebuild all indexes present in your database with the following query: EXEC sp_MSforeachtable @command1=”print ‘?’ DBCC DBREINDEX (‘?’, ‘ ‘, 80)” GO EXEC sp_updatestats GO
There are two ways to prevent your SQL code from running on a testing or production server. You can use the @@SERVERNAME Variable or the DB_NAME function, as shown next
For a given number, it may be necessary to know the sign of the number for computation purposes. If it is positive, zero or negative, you may have respective case
MySQL is capable of returning the result of a LIKE directly in the result set itself. For example, if you use a wildcard character in a query such as below,
You can easily find tables referenced by foreign keys with a script similar to the following: SELECT = s.name + N’.’ + t.name FROM sys.tables AS t INNER JOIN sys.schemas
Sp_help?provides a lot of information about the structure of the tables inside your database. You can highlight a table name in the SQL Query editor and then press the Alt
POSITION is a powerful function that helps you to find the position of a sub string in a string. Typically, the string is a column in a given table and
You can replace new lines and spaces inside a field with a statement similar to the following: REPLACE(REPLACE(LTRIM(RTRIM(FIELD_NAME)), CHAR(13), ”), CHAR(10), ”)
You can check which providers are installed on your server with this command: EXEC sp_MSset_oledb_prop