sql server stored procedure

Results 1 to 2 of 2

Thread: sql server stored procedure

  1. #1
    Join Date
    Dec 1969

    Default sql server stored procedure

    i am getting an error message from the following line of code:<BR>-----------------------------------------------------------------<BR>SET @ParentDisplayOrder = ""<BR>-----------------------------------------------------------------<BR>the error message basically said that "a column name cannot contain empty values. use " " or another value instead. so i adjusted the code in the stored procedure to:<BR>-----------------------------------------------------------------<BR>SET @ParentDisplayOrder = " "<BR>-----------------------------------------------------------------<BR>this is causing me the following error message:<BR>-----------------------------------------------------------------<BR> -2147217900 Invalid column name &#039; &#039;.<BR>-----------------------------------------------------------------<BR>the entire stored procedure that i am trying to create is as follows:<BR>-----------------------------------------------------------------<BR>CREATE PROCEDURE AddMessage<BR>(<BR> @ItemID int OUTPUT,<BR> @Title nvarchar(100),<BR> @Body nvarchar(3000),<BR> @ParentID int,<BR> @UserName nvarchar(100),<BR> @ModuleID int<BR>) <BR><BR>AS <BR><BR>/* Find DisplayOrder of parent item */<BR>DECLARE @ParentDisplayOrder as nvarchar(750)<BR><BR>SET @ParentDisplayOrder = " "<BR><BR>SELECT <BR> @ParentDisplayOrder = DisplayOrder<BR>FROM <BR> Discussion <BR>WHERE <BR> ItemID = @ParentID<BR><BR>INSERT INTO Discussion<BR>(<BR> Title,<BR> Body,<BR> DisplayOrder,<BR> CreatedDate, <BR> CreatedByUser,<BR> ModuleID<BR>)<BR><BR>VALUES<BR>(<BR> @Title,<BR> @Body,<BR> @ParentDisplayOrder + CONVERT( nvarchar(24), GetDate(), 21 ),<BR> GetDate(),<BR> @UserName,<BR> @ModuleID<BR>)<BR><BR>SELECT <BR> @ItemID = @@Identity<BR>-----------------------------------------------------------------<BR>can anyone show me how to fix this so that the CREATE PROCEDURE statement will run and i can create the stored procedure?<BR><BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default Do NOT use ""

    try this<BR>SET @ParentDisplayOrder = &#039;&#039;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts