Skip to Content
0
Former Member
Nov 02, 2010 at 02:33 AM

Variable for Query error

11 Views

Hi everybody!

I don't understand why i have error when run this query.

declare @Group as nvarchar(50)
set @Group= (select top 1 S3.[ItmsGrpNam]  from OITB s3  where  [ItmsGrpNam] ='[%1]')

declare @Thang as nvarchar(50)
set @Thang= (SELECT T0.[itemCode] FROM oitm T0 WHERE T0.[itemCode] = '[%2]')

SELECT @Group,@Thang

.

Unless i run one of two:

declare @Group as nvarchar(50)
set @Group= (select top 1 S3.[ItmsGrpNam]  from OITB s3  where  [ItmsGrpNam] ='[%1]')

It's work fine

and continue rung send one separate.

declare @Thang as nvarchar(50)
set @Thang= (SELECT T0.[itemCode] FROM oitm T0 WHERE T0.[itemCode] = '[%2]')

It's fine also.

But combine both, i can not run.

Please explain for me.

Thanks!