Data Getting truncated as I insert i.e. instead of inserting Hello it inserts 'H'

Last post 07-25-2005 7:55 PM by douglas.reilly. 1 replies.

Sort Posts:

  • Data Getting truncated as I insert i.e. instead of inserting Hello it inserts 'H'

    07-25-2005, 6:48 PM
    • Member
      207 point Member
    • nelazmeh
    • Member since 12-31-2004, 7:17 PM
    • Posts 45
    m inserting some data in big-sized field and small-sized fields, data of varchar type, int's, dateTime, and others... i am using something called a stored procedure to add data into a table.. now when i execute the stored procedure my data gets truncated (although i made the sizes for my fields ridiculously big like 1000 just in case) for example if i want to enter Jasmine it only inserts 'J' in the field

    I am sure there's something wrong in the stored procedure, and I am guessing it's a problem of using single vs. double quotes and stuff like that within my insert statement...
    the following is my stored procedure:

    CREATE procedure addLabor
    @lName varchar,
    @fName varchar,
    @mName varchar,
    @title varchar,
    @craft varchar,
    @lastFour varchar,
    @SSN varchar,
    @dateOfHire varchar,
    @currentProj varchar,
    @status tinyInt,
    @project_id int,
    @updateBy varchar,
    @updateDate varchar,
    @address varchar,
    @email varchar,
    @phone varchar,
    @zip varchar,
    @myfeedBack varchar,
    @ethnicity varchar,
    @userID int
    as
    BEGIN
    SET NOCOUNT OFF
    DECLARE @newid INT
    insert into laborPersonal ( lName, fName, mName, title, craft, lastFour, SSN, dateOfHire,  currentProj, status, project_id, updateBy,

    updateDate, address, email, phone, zip, ethnicity)
     VALUES
    (@lName  , @fName , @mName , @title  , @craft , @lastFour  , @SSN ,@dateOfHire  , @currentProj ,
    @status,  @project_id , @UpdateBy, @UpdateDate , @address , @email , @phone , @zip , @ethnicity )
    SELECT @newid = SCOPE_IDENTITY()
    insert into feedBack
    (lID, feedBack, userID, project_id)
    values
    (@newid ,+'
    +@myfeedBack + ',
    +@userID  ,
    @project_id )
    SET NOCOUNT ON
    END
    GO


    When i use 2 single quotes it insert the following string: "@lName" not the actual value of the variable @lName
    my exec statement is this:
    EXEC addLabor 'Razor', 'Nazor', 'mid', 'Mr', 'Carpenter Forman', '1234', 'keOWVozC+wmBvaqgkVkZci5y4vFLdTKfZOVG4C6BSN6H2MBP6pdsIWA0SdPAlPJra0EjEj+uXI/kXSiBuwwnKQ==', '6/27/2005 12:00:00 AM' , 'O.C. Public Library', 1, 3, '3', '7/25/2005 2:38:02 PM', '1233 Shady Canyon, Irvine', '', '', '12345', '123-12-1234', 'African American', '3'

    I appreciate any help or hints
    thanks to all
  • Re: Data Getting truncated as I insert i.e. instead of inserting Hello it inserts 'H'

    07-25-2005, 7:55 PM
    • All-Star
      23,295 point All-Star
    • douglas.reilly
    • Member since 11-19-2002, 4:19 PM
    • Brick, NJ USA
    • Posts 4,647
    All of your parameters are declared like this:

    @lName varchar,

    Should be like this:

    @lName varchar(1000),

    a type of varchar is like varchar(1), meaning a variable length string with a max of 1 character.  The number used should likely match the underlying length of the field in the table

    Starting with ASP.NET 2.0? Look at:
    Programming Microsoft Web Forms
    My Blog
Page 1 of 1 (2 items)