Ramco Ramco

Ramco Ramco

  • 417
  • 3.4k
  • 557.5k

Incorrect Syntax near )

Nov 5 2022 5:51 PM

Hi

 In below code i am getting Incorrect Synatx near ) - +'''')'

set @query = 'select [BookId] [Book ID],BookTitle [Book],[ClosingStock], ' + @cols + ' from (select [BookID] ,BookTitle,
,(select closingstock from [View_Summary] where BookId = ''' + @BookID +'''')' from View_Calculate where (('''+@BookID+'''=''0'' OR [BookId] IN('+ cast(@BookID as varchar(Max))+')))) x pivot
( Max(Status) for StudentName in (' + @cols + ')) piv order by B';

Thanks


Answers (2)