General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
RE : Ms-Sql2000....field check
Hi mate,
Thanks for your answer.This time;
At the " EXECUTE ('update mal set ' + @xdepo + ' = ' + @xmiktar + ' where malno = ' + @xmalno ) " row I have trouble, like; the statement of @xmalno should be double quotation mark.
Example = '0150020'
How can I use quotation mark with @xmalno statement.
' " ' + @xmalno + ' " ' -------------> returns error
' ' ' + @xmalno + ' ' ' -------------> returns error
Sample code is:
---------------
declare @max_sene smallint,@xmalno nvarchar(17),@xmiktar nvarchar(15),@xdepo nvarchar(9)
set @max_sene = (select max(sene) from path_dat)
DECLARE depo_hrk CURSOR FOR
select malno,cast(sum(miktar) as nvarchar(15)) as miktar,'depo_' + cast(depo AS nvarchar(4)) AS depo
from hrk
where sene = @max_sene
group by malno,depo
order by malno,depo
OPEN depo_hrk
FETCH NEXT FROM depo_hrk INTO @xmalno,@xmiktar,@xdepo
WHILE @@fetch_status = 0
BEGIN
EXECUTE ('update mal set ' + @xdepo + ' = ' + @xmiktar + ' where malno = ' + @xmalno )
FETCH NEXT FROM depo_hrk INTO @xmalno,@xmiktar,@xdepo
END
CLOSE depo_hrk
deallocate depo_hrk
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only