[RESOLVED]: Export data from Access table to SQL SERVER table programatically
Dear All,
I have a table in Access. I want to export the data from that table's fields into one field of SQL SERVER database table. for eaxmple.
Let I have a table named A in access. Table A has 5 fields. Also i have a table in SQL SQRVER.Let that table name is B. I want to export data from Access table A fileds into one field of SqlServer table B.
Can you help me plz.
Last edited by engineer; Aug 9th, 2005 at 10:50 AM.
Re: Export data from Access table to SQL SERVER table programatically
set 2 connections - one Connection with Access Database and One with SQL Database.
Set 2 record set - Recordset1 with Access and RecordSet2 with SQL.
Put One button - On click of this button Update the Data from RecordSet1 to RecordSet2....
Hope this will work... if works fine please rate my reply
Re: Export data from Access table to SQL SERVER table programatically
But here My earlier post will be work in either case ... all fields from access into one field in sql server or one to one.....
what do u think guys...
Last edited by Mark Gambo; Aug 8th, 2005 at 09:17 AM.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Re: Export data from Access table to SQL SERVER table programatically
Originally Posted by [LGS]Static
I thought he wanted one field.. hence the delimeter
Well, yeah, I see that NOOOW.... but you know as well as I that 90% of the time what was asked for isn't what the user wanted.... sometime you have to read between the lines and fake it.
Re: Export data from Access table to SQL SERVER table programatically
I have Tried Mark's code with some alteration. Now it inserts the records successfully in sql table, But for some of the records it gives me the following error on rsMSSQL.Update
ERROR:
Data provider or other service returned an E_FAIL status
Last edited by Mark Gambo; Aug 8th, 2005 at 03:44 PM.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Re: Export data from Access table to SQL SERVER table programatically
Originally Posted by engineer
Dear mark,
What I have observer so far is that the error comes if i try to insert the data having length > 8000 in the sql table fields( varchar).
The Max length of the varchar data type field is 8000, so when i try to insert the data having length > 8000, the error comes.
I am going to tackel with it by breakinmg the record in to two records, as it does not effect in my scenario.
Thankx for your help.
I would try either an "NVARCHAR" or a "TEXT" field type.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Re: Export data from Access table to SQL SERVER table programatically
Unless you are storing unitcode, nvarchar isn't going to be any better (and "Text" doesn't exist as a type in SQL Server).... SQL Server has a row data limit of 8k. That would be 8k characters ASCII or 4k characters unicode. That's all there is to it. So if you need something longer than that, it needs to be broken up over multiple rows, or multiple tables.
There is one alternative to that, and it involves using an image datatype and storing the binary version of the data, but it becomes much harder to extract.
Re: Export data from Access table to SQL SERVER table programatically
Originally Posted by techgnome
. . . and "Text" doesn't exist as a type in SQL Server . . .
You should check out this link. I have a TEXT, nTEXT data types in my copy of MS SQL
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
ntext, text, and image
Fixed and variable-length data types for storing large non-Unicode and Unicode character and binary data. Unicode data uses the UNICODE UCS-2 character set.
ntext
Variable-length Unicode data with a maximum length of 230 - 1 (1,073,741,823) characters. Storage size, in bytes, is two times the number of characters entered. The SQL-92 synonym for ntext is national text.
text
Variable-length non-Unicode data in the code page of the server and with a maximum length of 231-1 (2,147,483,647) characters. When the server code page uses double-byte characters, the storage is still 2,147,483,647 bytes. Depending on the character string, the storage size may be less than 2,147,483,647 bytes.
image
Variable-length binary data from 0 through 231-1 (2,147,483,647) bytes.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."