SQL Server problem

Hi There, I want to ask you how to insert the timestamp field in SQL Server trigger from another database, couse I have external application want to use to insert the record in database Navision to the NSC table ( table started from id 50.000 ). Means that I want to insert to Navision Database, a single record using SQL Server trigger from other database. for example : when I insert a record in database A, I want that record automatically insert the inserted record to table number 50.000 in Navision Attain SQL Server Option Thanks & Regards, Surya

In your SQL trigger, the insert statement should provide a NULL or DEFAULT for the timestamp field, e.g: INSERT INTO [CRONUS International Ltd_$Country] VALUES (NULL, ‘XX’, ‘New Country’, ‘’, ‘’, 0, 1) or INSERT INTO [CRONUS International Ltd_$Country] VALUES (DEFAULT, ‘YY’, ‘New Country2’, ‘’, ‘’, 0, 1) The timestamp field is usually the first field, but to be sure you can name each field in the INSERT statement.

ok… I think it is working for timestamp field, but how can I insert another field, couse VALUE can not load field name. for example : INSERT INTO [CRONUS International Ltd_$Country] VALUES (NULL, fieldA, fieldB, fieldC, fieldD) ??? but from what I read in SQL, they can insert Variable. so the line become : INSERT INTO [CRONUS International Ltd_$Country] VALUES (NULL, VariableA, VariableB, VariableC) I know that I have to Declare the Variable first using DECLARE @VaraibleA VarChar(30), @VariableB VarChar(30), @VariableC VarChar(30). What I want to ask is do you know how to put the inserted Value from FieldA, FieldB, FieldC into the @VariableA,@VariableB,@VariableC ??? in Trigger of SQL Server sintaks ??? Thanks Robert

Well, you don’t say where the FieldA, FieldB etc values are supposed to come from. But some simple examples are: To use a hard-coded value: DECLARE @CountryName VARCHAR(50) SELECT @CountryName = ‘Some Name’ INSERT INTO [CRONUS International Ltd_$Country] VALUES (NULL, ‘ZZ’, @CountryName, ‘’, ‘’, 0, 1) To insert a new row based on the result of a SELECT: INSERT INTO [CRONUS International Ltd_$Country] SELECT NULL, ‘UU’, [Name]+‘2’, [EU Country Code], [Intrastat Code], [Address Format], [Contact Address Format] FROM [CRONUS International Ltd_$Country] WHERE [Code] = ‘UG’ Remember, you need to execute variable declarations in the same batch as the statements that use them.