October 14, 2012 at 12:25 pm
I have a table which has id and statement columns, statement column contains statement like insert into tablename, update tablename, delete tablename (tablename might be any xxx), I have a scenario where I need to write a stored procedure, if I run SP it should get the insert records in statement column first with parent tablenames first and then child table insert into statement and after inserts update statement should come in any fashion and at last delete statement with child table statement first and then parent.
Output should be like
statements
INSERT INTO country(parent to state)
INSERT INTO state(parent to city)
INSERT INTO city(parent to zipcode)
INSERT INTO zipcode
October 14, 2012 at 11:44 pm
achtro (10/14/2012)
if I run SP it should get the insert records in statement column first with parent tablenames first and then child table insert into statement and after inserts update statement should come in any fashion and at last delete statement with child table statement first and then parent.
i dont think , there is any complexity (if you are storing the "insert" , "update" etc as records ) the required sequence can be maintained in SP itself like
INSERT INTO PARENT table
then
INSERT INTO CHILD table
then
UPDATE
then
DELETE
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply