Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2008
    Posts
    5

    Unanswered: Error while importing excel file

    Hi,

    I am trying to import some data from excel file by changing some column names and adding some columns through DTS package. I have mapped all the transformations and it looks fine. But when i execute the package it gives an error "No value given for one or more required parameters." Can anybody tell me where i am mistaken....

    Just follow steps for error:

    -->create an excel file : Test with ABC,pqr column headings.
    -->Import this to MS SQL and save the dts.
    -->Add a column "xyz" to the sql table Test.
    -->Now edit the dts transformation source tab sql query >> select `ABC`,`pqr`,`xyz` as 'null' from `Sheet1$`

    You will find that Parse Query Would work. But when you click on preview. It will raise the error "No value given for one or more required parameters."

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Code:
    `,`xyz` as 'null' from
    Just a few suggestions:
    Try `xyz` as null (get rid of quotes around 'null')
    or even better
    CAST (NULL AS (INT)) AS xyz (this one would work on database)

    Or do you really want a column with name 'null' and values 'XYZ' ?
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Oct 2008
    Posts
    5
    Hello Wim,

    Thanx for your reply. I just want to add a column name with null values to sql table through dts . During transfer, I would also like to convert the type of the field using CAST/CONVERT.

  4. #4
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Why don't you just create the destination table with the extra column giving it the data type you want it to have and don't store anything in it? That way its content will be NULL.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  5. #5
    Join Date
    Oct 2008
    Posts
    5
    I am actually trying to do the same thing as you have said. But when i add a required column in the select query picking up data from excel sheet, it gives error.

  6. #6
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Code:
    i add a required column
    A required column can never hold NULL.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

Posting Permissions

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