oledb command transform
hi guys ,
with out using a store procedure , can i declare variables and map to my variables in oledb command
like this
declare @var int = ?
declare @var1 char(10) = ?
declare @var2 int = ?
update xyz
set qwe = @var
where asd = @var1
delete from qwe
where column1 = @var
when i try this and go to mapping section it shows some syntax error can we do like this or store proc is the only way?
August 23rd, 2011 2:11pm
did you tried to put a semicolon after first update, like this:
declare @var int = ?
declare @var1 char(10) = ?
declare @var2 int = ?
update xyz
set qwe = @var
where asd = @var1;
delete from qwe
where column1 = @var;
http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2011 2:25pm
thanks for the reply , no i didnt but, i will try i have too many statements and i also used If exists
August 23rd, 2011 2:28pm
You may want to use a dynamic SQL like
MyExpression="UPDATE xyz set qwe = " + @[VariableContainingUpdateValue] + "where asd =" etc...
more help http://consultingblogs.emc.com/jamiethomson/archive/2005/12/09/2480.aspx
Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2011 2:28pm