hi
I have code like below but doesn't work when if put where clause in set @ts
set @ts = 'select '+ @xhr +' from tblTotAbsen where no_induk ='+ @no_induk
but without clause where coding is work
set @ts = 'select '+ @xhr +' from tblTotAbsen
problem how this code below work if using where clause
ALTER PROCEDURE [dbo].[BacaRumus]
@no_induk nvarchar(50)
AS
BEGIN
SET NOCOUNT ON;
declare @xhr nvarchar(max),@ts nvarchar(max)
set @xhr = 'no_induk,xmasukp,xoff,xmasukp + xoff as totsw'
set @ts = 'select '+ @xhr +' from tblTotAbsen where no_induk ='+ @no_induk
Exec (@ts)
END
thanks