There is a table with existing records with different entity ids, now need to insert records in the Table using Cursor and without hard coding the records.
Please find my script below.
DECLARE @txId varchar(50) Declare @UserRole_id int @txId = NEWID()
set @UserRole_id = (SELECT @UserRole_id = MAX(User_Role_Id) + 1 FROM USER_TB
INSERT INTO USER_ROLE_TB (User_Role_id, entity_Id, User_role_code, User_Role_description, Print_Sequence, Update_date, Tx_id, Add_date, Add_Username, Update_Username, Active_Flag)
Values...
(@UserRole_id,entity_Id,'ACH ','AC-HEATING',7,GETUTCDATE(),@txID,GETDATE(),'30383212','30383212',1) (@UserRole_id,entity_Id,'BRAKE TECH','BRAKE',8,GETUTCDATE(),@txID,GETDATE(),'30383212','30383212',1) (@UserRole_id,Pos_entity_Id,'CASH OUT','CASH OUT TECHNICIAN',4,GETDATE(),@txID,GETDATE(),'30383212','30383212',1)
Here i have hardcoded the records what if i have to insert new records. Im not sure how do i do it.
i got to insert in these column without harding coding them and using cursor.
Not so familiar with Cursor. Please help.