If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Error while importing excel file

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-24-08, 05:14
mayurgogia mayurgogia is offline
Registered User
 
Join Date: Oct 2008
Posts: 5
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."
Reply With Quote
  #2 (permalink)  
Old 11-24-08, 07:12
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 582
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
Wim

Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Reply With Quote
  #3 (permalink)  
Old 11-24-08, 22:27
mayurgogia mayurgogia is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 11-25-08, 05:56
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 582
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
Wim

Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Reply With Quote
  #5 (permalink)  
Old 11-26-08, 00:48
mayurgogia mayurgogia is offline
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old 11-26-08, 05:28
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 582
Code:
i add a required column
A required column can never hold NULL.
__________________
With kind regards . . . . . SQL Server 2000/2005
Wim

Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On