Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
PatDeV
Posting Yak Master
197 Posts |
Posted - 2006-08-11 : 16:47:03
|
declare @cmd as varchar(4000)set @cmd = 'select count(ID)FA00100_count from test1 goselect count(ID) IV40400_Count from test3goselect count(ID)POP10100_count from test4 'exec master.dbo.spSQLSMTPMail @vcTo = 'test@test.net', @vcSubject = 'Record Count',@vcQuery = @cmdwhen i try to do this it gives me error saying thatServer: Msg 105, Level 15, State 1, Line 3Unclosed quotation mark before the character string ''select counthow can i solve this |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-08-11 : 17:01:38
|
GO is always a batch terminator, even when it is inside quotes.You can work around it this way:declare @cmd as varchar(4000)set @cmd = 'select count(ID)FA00100_count from test1 g'+'oselect count(ID) IV40400_Count from test3g'+'oselect count(ID)POP10100_count from test4 ' CODO ERGO SUM |
 |
|
schuhtl
Posting Yak Master
102 Posts |
Posted - 2006-08-11 : 17:03:02
|
you could also do the following:'select count(ID)FA00100_count from test1;select count(ID) IV40400_Count from test3;select count(ID)POP10100_count from test4 ' |
 |
|
|
|
|