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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

ruby - Nesting modules inside of a Rails eninge gem -

Eclipse formatter for java ending braces -