May 26, 2011 at 11:01 am
Hello,
When I create table as per code data is inserted in first successfully as ENG_REF value Engg0000000000 but when i insert in second row it showing an error message "Can not Insert Duplicate Key"
Any idea how to fix it.
May 26, 2011 at 11:11 am
Gopal Singh (5/26/2011)
Hello,When I create table as per code data is inserted in first successfully as ENG_REF value Engg0000000000 but when i insert in second row it showing an error message "Can not Insert Duplicate Key"
Any idea how to fix it.
my fault; the formula for the calculated column should have used the RIGHT function, not the LEFT.
i edited the psot above, so you can grab it again.
Lowell
May 27, 2011 at 8:10 am
Hello David,
Using your code My Problem was sloved, Thanks for It.
I have another issues. I have one parent table that is Eng_Details and one child table that is Eng_Edu_Details.
My Question is when I enter information in End_Edu_Details, Date are changes as last time modified it in Eng_Edu_Details, but not changes the dates in Eng_Details, I have seprate trigger on both table when any record insert in child table date shpuld change to current date when record are insert or modified.
Primary key of Parent table is foreign key in child table.
Can you give me how to do it like by triggers????
May 27, 2011 at 10:04 am
Post your trigger definition on End_Edu_Details and we can help you modify it to also update the date on Eng_Details.
______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
May 27, 2011 at 11:24 am
Hello,
I need to create trigger which allow to insert primary key in main automatically when inserted to it and then automatically inserted in child table
create trigger trg_Eng_Edu_Details on dbo.Eng_Edu_Details
declare @dt varchar
set @dt=getDate()
for insert as update t set t.curr_date=(CONVERT(VarChar(50), GETDATE(), 101)) from Eng_Edu_Details t
inner join inserted i on i.Eng_Id=t.Eng_Id
go
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply