Groups | Blog | Home
all groups > sql server dts > november 2004 >

sql server dts : Error--Update Staement



Steve
11/5/2004 1:29:03 PM

Hi,
I am getting error when I run the following statement




declare @a nvarchar(255)
select @a = tblname from logtbl where tblname like 'orders%'
and logtbl.logdate > getdate() - .5

update @a
set @a.log_id = l.log_id
from @a , logtbl l
where l.logdate > getdate() - .5
l.tblname like 'orders%'


Server: Msg 137, Level 15, State 2
Must declare the variable '@a'.

Plz.help

Allan Mitchell
11/6/2004 8:18:38 AM
You cannot use variables like this. If you want to do this then consider
using

1. Dynamic SQL

http://www.sommarskog.se/

2. DTS and the object model

Global Variables and SQL statements in DTS
(http://www.sqldts.com/default.aspx?205)

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


[quoted text, click to view]

AddThis Social Bookmark Button