sql server 2008 - How to create a Trigger for creating the columns in a table on the insertion of data in another table -
i having table mstattributes trnindexattributes. want create many columns in trnindexattributes table many rows there in mstattributes. means after insertion of value in mstattributesone column should created in trnindexattribute table id1,id2,id3....
if feel doing (despite rightful warning of philip kelley), you'll have use dynamic query.
declare @query nvarcjar(max) = n'alter table tableofinfinitedoom add column' + [your logic name] + [your ligic type] exec sp_executesql @query in trugger (don't fortget loop if handle multyrows dml).
Comments
Post a Comment