Jessynoo wrote:
Try adding another column.
I added a (bogus) nullable column TestId with a relation to table 'Country'.
Even if I set TestId to something, the INSERT for the title-table leaves out the Id.
Here is what I can see in Profiler:
declare @p3 int
set @p3=13
exec sp_executesql N'INSERT INTO [Fibu].[dbo].[BaseData] ([LanguageId], [Nr], [Description]) VALUES (@LanguageId, @Nummer, @Description);SELECT @Id_BaseDataEntity=SCOPE_IDENTITY()',
N'@Id_BaseDataEntity int output,@LanguageId int,@Nummer smallint,@Description nvarchar(50)',
@Id_BaseDataEntity=@p3 output,@LanguageId=4,@Nummer=100,@Description=N'Herr'
select @p3
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [Fibu].[dbo].[Titel] ([testid]) VALUES (@Testid);SELECT @Id=SCOPE_IDENTITY()',N'@Id int output,@Testid int',@Id=@p3 output,@Testid=2
select @p3
As you can see in the 2nd INSERT, Titel.Id isn't touched at all...
Thanks,
Juergen