try this one...
select print_ticket_ind, Class_name,Status,acct_id, section_name, event_date, event_time,printed_datetime from openquery(premclub,
'select * from dba.v_ticket where Class_Name = ''PC_Default'' and Status = ''Sold'' and print_ticket_ind = ''y'' and section_name like ''ST%'' or...
using Pivot function
SELECT location, fmtitemno as ItemNo, [1] AS Price1, [1001] as ReceiptNo1, [2] AS Price2, [1002] as ReceiptNo2, [3] AS Price3, [1003] as ReceiptNo3,
[4] AS Price4, [1004] as ReceiptNo4
FROM (SELECT location,fmtitemno,docnum, averagecost, rk , rk + 1000 rknew
FROM...
try this one
declare @v_input varchar(50)
declare @v_sql varchar(1000)
set @v_input = '6,IC,5'
Select @v_sql = 'Select * From Units Where Unit Like ''%' + REPLACE(@v_input, ',', '%'' Or Unit Like ''%') + '%'' '
Select @v_sql
Exec (@v_sql)
Mega
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.