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
if you are trying to restore a database from a backup file that is on a network server… the sql server service needs to be running under a domain account that has privileges to the network share you are trying to retrieve the backup file…
–date conversion methods: also 127 in ics file select convert(varchar, GetDate(), 100) as ‘100 Conversion’, — Dec 21 2010 3:13PM convert(varchar, GetDate(), 101) as ‘101 Conversion’, — 12/21/2010 convert(varchar, GetDate(), 102) as ‘102 Conversion’, — 2010.12.21 convert(varchar, GetDate(), 103) as ‘103 Conversion’, — 21/12/2010 convert(varchar,…
you can restart sql server agent during business hours, but make sure that it won’t be stopped when a scheduled job is set to run.
instructions to setup database mail and job notification emails also, if you want to use your companies exchange server, then you need to make sure that smtp is enabled for the server that you want to send email from.
run first: sp_configure ‘show advanced options’, 1; RECONFIGURE; then this: sp_configure ‘Ad Hoc Distributed Queries’, 1; RECONFIGURE; ad hoc opens security issues – use very carefully!! only supposed to use ad hoc if there is infrequent access to the data for any data sources that…