May 19, 2004 at 10:11 pm
how do i declare a query inside a stored procedure, this is silly i know, but i was trying this for a long time.
i want to set the query into a variable and then i will
execute tht query by sp_executesql
iam using SQL2000
now this thing shows error, what to do exactly
--------------------------
declare @insertSql varchar(5000)
set @insertSql='Insert into RMCPL_MAIL_HD(RMCPL_DT,RMCPL_SUB,rmcpl_usr) values('" + "12/12/2004','" + "'llolove',27)"'
------------------
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
May 20, 2004 at 1:36 am
declare @insertSql varchar(5000)
set @insertSql='Insert into RMCPL_MAIL_HD(RMCPL_DT,RMCPL_SUB,rmcpl_usr) values(' + '''12/12/2004'',' + '''llolove'',27)'
Alternatuvely, you should be able to create a function quotename()
see article for description, which would make code a more readable
May 22, 2004 at 6:09 am
Dear Sukhoi
See the following way i had done this. here i had a table MMM and one field on that table USERNAME and i am putting the value on that.
DROP PROC SPEXAMPLE2
CREATE PROCEDURE spExample2
as
declare @aa varchar(50)
set @aa= 'INSERT INTO MMM VALUES(''sheetal'')'
EXEC (@aa)
EXEC SPEXAMPLE2
( Manish Kaushik )
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply