I'm hoping this is an easy question, as my SQL knowledge is limited.

I need to create stored procedures which takes the tablename as a variable,
and can't seem to get it to work. There must be a work around for this- I
hope!

Here's my procedure:

CREATE PROCEDURE st_calendarevent
@userID [numeric], @thisdate [smalldatetime], @eventtable [varchar](20)
AS
SELECT
e.eventID, e.event, e.description, e.starttime, e.endtime, e.location,
e.url, e.priority, e.category, e.contactID, e.projectID, e.projectname,
e.contactname, e.done, c.businessphone, e.leadID, e.leadname
from @tablename as e LEFT JOIN contacts as c ON c.contactID = e.contactID
where e.userID = @userID AND e.eventdate = @thisdate
order by e.starttime
GO

TIA!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to