Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 format a query and execute it using exec

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-25 : 09:28:22
Saravanan P K writes "exec('select a.site_id,a.system_id,convert(datetime,@wfromdate),@logic
from eserv_equipment_utilization_data a
where @type=@value and day(a.date_time) =@dfromdate and month(a.date_time)= @mfromdate and year(a.date_time)= @yfromdate group by a.site_id,a.system_id')"

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-07-25 : 09:35:59
declare @cmd varchar(2000)
set @cmd='select a.site_id,a.system_id,convert(datetime,@wfromdate),@logic
from eserv_equipment_utilization_data a
where @type=@value and day(a.date_time) =@dfromdate and month(a.date_time)= @mfromdate and year(a.date_time)= @yfromdate group by a.site_id,a.system_id'

exec(@cmd)

HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -