select Row_Number() over( order by getdate() ) as SN,* from table
exec sp_helptext spRpt_R169_v2
SELECT b.name as TableName,a.name as columnname
From syscolumns a INNER JOIN sysobjects b
ON a.id=b.id
AND a.name like 'plan%';
select [day]=day(order_entered_dt)
from dbo.SM_Comm_CompMapping
where month(order_entered_dt)=4 and year(order_entered_dt)=2015
group by day(order_entered_dt)
order by day(order_entered_dt)
datediff(dd, s.Order_Entered_dt, getdate())< 30