Hello
I have a sql 2008 R2 problem that I’ve tried to accomplishing using dynamic sql but, no luck yet.
Im wanting to create a stored procedure that will lookup the description of the event id and event data in table Events based on a table name in another table. I have found examples of dynamic sql that will return the Desc for one row but there will be many many rows returned in this query.
Events.EventID--- EventDataLookup .Event
Events.EventDat a—TypicalEventD escX.EventData
The DataLookupTable Name Contains the name of the table from which the Events.EventDat a can be tied to TypicalEventDes c1.EventDataDes c or tied to TypicalEventDes c2.EventDataDes c
Is what I’m wanting to do even possible?
I have a sql 2008 R2 problem that I’ve tried to accomplishing using dynamic sql but, no luck yet.
Code:
Create Table Events ( PKID int Not Null, TimeStamp Datetime, EventID int, Eventdata int) Create Table Eventdatalookup( Event int, DataLookupTableName varchar(100)) Create Table TypicalEventDesc1( EventData int EventDataDesc varchar(100) Create Table TypicalEventDesc2( EventData int EventDataDesc varchar(100)
Events.EventID--- EventDataLookup .Event
Events.EventDat a—TypicalEventD escX.EventData
The DataLookupTable Name Contains the name of the table from which the Events.EventDat a can be tied to TypicalEventDes c1.EventDataDes c or tied to TypicalEventDes c2.EventDataDes c
Is what I’m wanting to do even possible?
Comment