I have an insert statement in MSSQL as follows:
INSERT INTO A(KeyId, KeyName, Name)
SELECT ('?','?',BName)FROM B
The value of KeyId and KeyName are retreived from another table D
Table B- Table C mapping is BName= XName Table C- Table D mapping is Xname = XName There are like 1000 records from B which need to be inserted into A. how can i write an SP for the same?
Table A Columns - KeyId,KeyName,Name Table B Columns - Id,BName Table C Columns - XName Table D Columns - KeyId,KeyName, XName