mister.magoo (10/14/2013)
In your version of SQL Server, you cannot use the form
DECLARE @myvar varchar(100) = 'Some Value';
You have to use two statements, one to DECLARE then a SET.
DECLARE @SQLQuery VARCHAR(100);
SET @SQLQuery = 'select * from Table where ID=@ID';
Huh. I learned TSQL on SQL Server 2005, but I complete forgot you cannot assign a value to a variable while declaring it.
Time flies by
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
You may want to consider rewriting this process using SSRS. The Web Assistant procedures have been deprecated and I don't believe they exist in SQL Server 2008 or later.
The code worked for sometime ...
then it stopped working.
It gave me these extracts SSIS570.html where 570 is the ID passed as a parameter.
After testing it a couple of times it started giving me onlySSIS5.html with no data in it.Any other ID I passed say 455 it would give me SSIS4.html with no data in it.Any thoughts where the code got messed up ?
CODE:
alter procedure [dbo].[usp_Names]
(@ID varchar)
AS
DECLARE @TaskOutFile VARCHAR(255)
DECLARE @SQLQuery VARCHAR(100)
SET @SQLQuery ='select * from dbo.InfectionControl where ID='+CAST(@ID AS VARCHAR(20));
Select @TaskOutFile = 'C:\SSIS' + @ID + '.html';
EXEC sp_makewebtask @outputfile =@TaskOutFile ,
@query = @SQLQuery;
Viewing 15 posts - 1 through 15 (of 20 total)
You must be logged in to reply to this topic. Login to reply