Sql server simple insert trigger issue?

When declaring character data types You have to specify their length, otherwise, SQL Server will assume they are of length 1 and as such it will show first character only You need to declare @ParentPath and @Path as varchar(100) (change 100 to appropriate) and when converting @NewId to varchar You need to convert it to varchar of specified length also: declare @ParentPath varchar(100); set @ParentPath = (select path from positions where Id = @NewParentId) declare @Path varchar**(100); set @path = @ParentPath + '/'+ convert(varchar(100), @NewId) update Positions set Path = @path where Id= @NewId Please note that this trigger will fail if someone inserts multiple records in single INSERT statement. You should rewrite it to support multiple rows inserts.

When declaring character data types You have to specify their length, otherwise, SQL Server will assume they are of length 1 and as such it will show first character only. You need to declare @ParentPath and @Path as varchar(100) (change 100 to appropriate) and when converting @NewId to varchar You need to convert it to varchar of specified length also: declare @ParentPath varchar(100); set @ParentPath = (select path from positions where Id = @NewParentId) declare @Path varchar**(100); set @path = @ParentPath + '/'+ convert(varchar(100), @NewId) update Positions set Path = @path where Id= @NewId Please note that this trigger will fail if someone inserts multiple records in single INSERT statement. You should rewrite it to support multiple rows inserts.

2 Path variables should be 260 characters long. (longer if you allow the long path form with \\? \ prefix.) see msdn.microsoft.

Com/en-us/library/… – Filip De Vos Nov 14 at 10:18 @FilipDeVos, I upvoted your comment because it is brilliant suggestion for particular case (Windows platform, file paths). However, OP didn't specify what does path relates to (categories, windows path or something else). – Filip Popović Nov 14 at 10:24 I assumed MS Sql Server hence windows.

The type should also be NVARCHAR by the way. Once bitten, twice shy. – Filip De Vos Nov 14 at 10:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions