SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 automatic import datatype error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

slimjen
Yak Posting Veteran

61 Posts

Posted - 06/29/2012 :  22:06:04  Show Profile  Reply with Quote
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

India
47189 Posts

Posted - 06/29/2012 :  22:43:51  Show Profile  Reply with Quote
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 - 06/29/2012 :  22:58:58  Show Profile  Reply with Quote
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

India
47189 Posts

Posted - 06/29/2012 :  23:07:19  Show Profile  Reply with Quote
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 - 06/29/2012 :  23:17:00  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000