473,765 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can i transfer data from sql server into excel

198 New Member
Hi
i want to transfer data from sql server to access .Is it possible if yes then
give some idea how i will transfer

i did this by connecting with sql server and access data in sql recordset and also open msaccess database but after that i am getting confused
am i going right

please give some idea
May 24 '08 #1
8 2243
CyberSoftHari
487 Recognized Expert Contributor
Yes, you have to use store procedure in Sqlserver database and call it from frontend.
Below Query will explain about insert to MS Access database
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 
  2. 'Data Source="C:\DB1.MDB ";User ID=Admin;Password=;')...MSAccessTableName (field1, field2, field3)
  3. SELECT field1, field2, field3 
  4. FROM SqlServerTableName 
(I think this should move to Sql Server!)
May 24 '08 #2
veer
198 New Member
Hi
i use the following query

sQuery = "insert INTO OpenDataSource( 'Microsoft.Jet. OLEDB.4.0;Data Source='D:\Upda tion\YpUpDate_P erformace.mdb'; ')Ypupdate(PgNm br,Yp1EOp,Yp1VO p,Yp1EStartTime ,Yp1EEndTime,Yp 1VStartTime,Yp1 VEndTime,Oks,Cr opImgType)selec t * from Ypdata"

Ypupdate is mdb table name and ypudate is sql table name
but this is showing incorrect systax near D:\

please check and correct this code







Yes, you have to use store procedure in Sqlserver database and call it from frontend.
Below Query will explain about insert to MS Access database
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 
  2. 'Data Source="C:\DB1.MDB ";User ID=Admin;Password=;')...MSAccessTableName (field1, field2, field3)
  3. SELECT field1, field2, field3 
  4. FROM SqlServerTableName 
(I think this should move to Sql Server!)
May 26 '08 #3
debasisdas
8,127 Recognized Expert Expert
you need to open two connection string one each for the database.

fetch record from sql server and insert the same into msaccess.
May 26 '08 #4
CyberSoftHari
487 Recognized Expert Contributor
You have to try your self (do not let me to check.)
Syntax:
Insert Into OpenDataSource(
'Microsoft.Jet. OLEDB.4.0'
(-> Oledb Jet connector to MS Access) ,
'Data Source=D:\Updat ion\YpUpDate_Pe rformace.mdb;Us er ID=Admin;Passwo rd=;')
(-> Open database with username and password)
...Ypupdate (-> triple dot tablename to open table)
(f1, f2,f3,f4…) are fields
Usual select query to insert in the access table.

Change your query and debug it yourself.
Expand|Select|Wrap|Line Numbers
  1. insert INTO OpenDataSource('Microsoft.Jet.OLEDB.4.0', 'Data Source=D:\Updation\YpUpDate_Performace.mdb;User ID=Admin;Password=;')...Ypupdate
  2. (PgNmbr,Yp1EOp,Yp1VOp,Yp1EStartTime,Yp1EEndTime,Yp1VStartTime,Yp1VEndTime,Oks,CropImgType)
  3. select * from Ypdata
All the best.
May 26 '08 #5
veer
198 New Member
Hi
thanks for reply it works and transfer data but when i executes the program by putting break point all the data transfer which i want yes, and filter the data according to my conditions in other tables it all works fine during break points and
when i execute the program without break point it is not transfering all data and not filtering the data and insert into other tables which has worked fine during breakpoints
can you tell me what is wrong if you want my coding the please write me

thanks in advance

varinder










You have to try your self (do not let me to check.)
Syntax:
Insert Into OpenDataSource(
'Microsoft.Jet. OLEDB.4.0'
(-> Oledb Jet connector to MS Access) ,
'Data Source=D:\Updat ion\YpUpDate_Pe rformace.mdb;Us er ID=Admin;Passwo rd=;')
(-> Open database with username and password)
...Ypupdate (-> triple dot tablename to open table)
(f1, f2,f3,f4…) are fields
Usual select query to insert in the access table.

Change your query and debug it yourself.
Expand|Select|Wrap|Line Numbers
  1. insert INTO OpenDataSource('Microsoft.Jet.OLEDB.4.0', 'Data Source=D:\Updation\YpUpDate_Performace.mdb;User ID=Admin;Password=;')...Ypupdate
  2. (PgNmbr,Yp1EOp,Yp1VOp,Yp1EStartTime,Yp1EEndTime,Yp1VStartTime,Yp1VEndTime,Oks,CropImgType)
  3. select * from Ypdata
All the best.
May 28 '08 #6
CyberSoftHari
487 Recognized Expert Contributor
there i said, better use store procedure to do all the data updates and call from front-end.
May 28 '08 #7
veer
198 New Member
Hi
Thanks For reply
but can you give me some example

pleeeeeeeeeeeee eez




there i said, better use store procedure to do all the data updates and call from front-end.
May 28 '08 #8
CyberSoftHari
487 Recognized Expert Contributor
In sql server, select new storeprocedure
Expand|Select|Wrap|Line Numbers
  1. Create Procdure ProcedureName
  2. Begin Tran
  3. insert INTO OpenDataSource('Microsoft.Jet.OLEDB.4.0', 'Data Source=D:\Updation\YpUpDate_Performace.mdb;User ID=Admin;Password=;')...Ypupdate
  4. (PgNmbr,Yp1EOp,Yp1VOp,Yp1EStartTime,Yp1EEndTime,Yp  1VStartTime,Yp1VEndTime,Oks,CropImgType)
  5. select * from Ypdata
  6.  
  7. IF(@@Error != 0)
  8. Begin
  9. Rollback
  10. End
  11. commet
  12.  
and call it from front end..like

Expand|Select|Wrap|Line Numbers
  1. connection.Execute ("ProcedureName()")
May 28 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2322
by: Andy Davis | last post by:
Has anybody tried and had any success exporting data directly from ACT! 2000 to an Access database? I need to transfer data from ACT! to Access, but the data is all imported as text, including date and number fields. If I transfer it to EXCEL first and then to Access, it is imported to Access in the correct format. Would like to know if there is an easier or quicker method of doing the transfer to Access? Regards and thanks in advance ...
1
4312
by: cfyam | last post by:
How can I transfer Excel data to Sql Server?
11
6044
by: Alexander Bosch | last post by:
Hi, I'm having a problem similar to the one that's stated in this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 When I'm posting a page to itself with the bool value as true it falls into an infinite loop and later a StackOverflow Exception. I need to do this and not a Response.Redirect or a transfer with the bool in false. My problem is that this KB is saying that this problem should be solved with ServicePack 1 of...
10
16562
by: scoopthis | last post by:
Hi, I have an application where I transfer an excel file to a table on SQL through an adp file. The excel file does change so I pass the name parameter from a cmd line. The excel file has a specific range defined of 20,000 records. Currently the process is using ac.DoCmd.TransferSpreadsheet acImport and it pulls in all 30,000 records even though there isn't data in all 20,000 records (lots of nulls). How can I get the process to only transfer...
5
7588
by: hmiller | last post by:
Hey there folks: I have been trying to get this work for about a week now. I'm new to VBA... I am trying to transfer a populated table in Access to an existing, but blank, Excel worksheet. I have seen methods for transfering cell by cell, and understand how to get that to work. However, my recordset has 3600 cells of data. Cell by cell is just not an option. I am looking for a way to specify the starting cell (most upper left cell) in...
3
4117
by: JohnM | last post by:
I can transfer from a query with DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Filenam", CPath, True I would like to use a form for the user to select and order data then export th result. How do I set about this?
2
6790
by: sachin shah | last post by:
Hi All, 1. i want to transfer the .csv file data into sql server table, i tried with the DTS but while creating DSN it not prompt to attech the .csv file. give me the proper steps to perform the data transfer... 2. i want result of my query into excel or text file by using the sql query( like Select * from employee where emp_salary>10000 to 'c: \emp.xls).i know the other way right click into query analyzer window
1
2224
by: is49460 | last post by:
Good afternoon! I use transfer spreadsheet function the export data from one of the table into the excel spreat sheet. I use the following code: DoCmd.TransferSpreadsheet acExport, 8, "qry Rejected Items", Path & "Output Files\Rejected Items.xls", True, "NewData" Please note that the output should be placed in the "NewData" tab. In the same excel file the output was made to, i have function that is excecuted on open: Sub Auto_Open()
2
1676
by: =?Utf-8?B?Y2xhcmE=?= | last post by:
Hi all, I have some data in a worksheet and need to be transfered to a table in SQL Server 2005 using VB 2005, the question is how can I manipulate the Excel object model and access to the data in the worksheet. Clara thank you so much for your help
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.