Category: sql sever syntax
so that you can rollback if you don’t get the expected results using rollback transaction if you don’t use BEGIN TRANSACTION, then you will have to revert the database to a backup to restore the data if you get the expected results from the transaction,…
SELECT * INTO AdventureWorks.dbo.CustomersTemp FROM Northwind.dbo.Customers Just remember that using this query will only transfer the schema and data. It does not transfer the indexes, foreign keys, statistics etc.
select @@Version SELECT SERVERPROPERTY(‘productversion’), SERVERPROPERTY (‘productlevel’), SERVERPROPERTY (‘edition’)
use msdb exec sp_send_dbmail @profile_name = ‘ss job notifications’, @recipients = ‘put email address here’, @subject = ‘live database sizes’, @query = ‘use databasename select db_name(dbid),str(convert(dec(15),sum(size))* 8192/ 1048576,10,2)+ N” MB” as Size from sys.sysaltfiles group by dbid order by 2 desc’, @attach_query_result_as_file = 1;
put two single quotes where there was one ie – ‘string ‘inside’ of something’ then do this – ‘string ”inside” of something’ — 2 single quotes not a double quote
exec sp_dboption dbname, ‘select into/bulkcopy’, ‘TRUE’ exec SP_dboption dbname,’trunc. log on chkpt.’,’true’