Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 automatic import datatype error

Author  Topic 

slimjen
Yak Posting Veteran

61 Posts

Posted - 2012-06-29 : 22:06:04
Before I upsized my access backend to SQL; I used a command button to automatically import several excel spreadsheets into an access table. I formatted the alphanumeric fields as text in the spreadsheet. Because the access would use it's own judgement and change my alphanumeric fields to number instead of text; I had to improvise by inserting the word "text" in the first field of the column and deleting it out of the table after import. It was dirty but it worked. Now that I have a SQL backend; is there any other way to have my imports maintain the spreadsheet format when automatically importing?
Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-29 : 22:43:51
yep. you can do implicit cast if you want.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

slimjen
Yak Posting Veteran

61 Posts

Posted - 2012-06-29 : 22:58:58
implicit cast? I don't remember how to use this but I will do some research. Can you give me an example?

This is my code for the import:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, _
''"tblSP_SHIPMENT_temp", "C:\Users\JEN\Desktop\ACFAST_VER4\SMALLPACKAGEIMPORT.xls", True

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-29 : 23:07:19
hmm...are you looking for access query?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

slimjen
Yak Posting Veteran

61 Posts

Posted - 2012-06-29 : 23:17:00
This is from the function I was using before the upsize to sql. Is there another way I can import the excel spreadsheet automatically? Thanks
Go to Top of Page
   

- Advertisement -