Showing posts with label inserted. Show all posts
Showing posts with label inserted. Show all posts

Friday, March 23, 2012

please check this trigger

Aperently I could not insert a text field to another table from INSERTED in a trigger.
It seems th follwoing is working, do you see any problem joining INSERTED to the mySrcTable
which is the table that has this trigger

INSERT INTO myRemoteDatabase.dbo.myDestTable (myTrID,myFirstName,myBigText)
SELECT i.myTrID, i.myFirstName, p.myBigText
FROM INSERTED i INNER JOIN mySrcTable p ON i.myTrID = p.myTrID
WHERE (i.myTrType = 'In')

Thanks,

You can set the compatibility level to 80 or higher Or you can choose varchar(max) which has limitation of 8000 characters.

For details seeCREATE TRIGGER.

Hope it helps.

sql

Friday, March 9, 2012

Pk to be initiated every time?

i want primary key of table to be inserted automatically. i've set its in desgin table as Identity = Yes; Seed=1

i want my application all other attributes except primary key which i've set atutomatically inserted.

but by doing this; it doesn't insert its value. instead it enters 0

can u plz help me in doing so?

Hi,

You are probably not doing things in the right way. It's a good idea to try ceating the table using a create table script and see if the problem persists or not:

CREATE TABLE TableName( PrimaryKeyColumnNameINT IDENTITY PRIMARY KEYNOT NULL, Column1 DataType, ...)

Happy SQLing!

Mehrdad