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
 General SQL Server Forums
 New to SQL Server Programming
 Insert Excel data in Database SQL SERVER 2005
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vassily Zaitsev
Starting Member

Brazil
13 Posts

Posted - 04/27/2012 :  15:39:52  Show Profile  Reply with Quote
Hello Guys
I'm new to the forum and i have a doubt.
I have a table created in Excel 2007 and want to update the table through this data in SQL Server 2005 table.
I already have the connection created so missing commands INSERT, UPDATE, and DELETE
I click the button and make the action work
I have a sample table: http://www.sendspace.com/file/mlgbds
Who can help me I thank you very much
a few weeks ago to this information.
Regards to all.

visakh16
Very Important crosS Applying yaK Herder

India
47173 Posts

Posted - 04/27/2012 :  15:46:12  Show Profile  Reply with Quote
use linked server or OPENROWSET

see

http://www.simple-talk.com/sql/t-sql-programming/sql-server-excel-workbench/

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

Go to Top of Page

Vassily Zaitsev
Starting Member

Brazil
13 Posts

Posted - 04/27/2012 :  16:00:14  Show Profile  Reply with Quote
Thanks buddy for the quick response, I look at the link and study hard
you have any examples created with this my need?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47173 Posts

Posted - 04/27/2012 :  16:00:46  Show Profile  Reply with Quote
the link has working code itself.

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

Go to Top of Page

Vassily Zaitsev
Starting Member

Brazil
13 Posts

Posted - 04/27/2012 :  16:01:49  Show Profile  Reply with Quote
thank you friend
Go to Top of Page

Vassily Zaitsev
Starting Member

Brazil
13 Posts

Posted - 05/04/2012 :  15:40:52  Show Profile  Reply with Quote
even with the link sent I did not managed to solve my problem
I want to update the worksheet data in a column "A"
two columns are
example:
[A] [B]
1 Maria
Aline 2
3 Alex

I want to update the numbers in column "A"
[A] [B]
55 Maria
56 Aline
57 Alex
this is what I do, just update the data in column "A".
Who can help me thank you.
Go to Top of Page

Vassily Zaitsev
Starting Member

Brazil
13 Posts

Posted - 05/04/2012 :  15:43:30  Show Profile  Reply with Quote
in my spreadsheet I have 3 buttons
[INSERT]
[UPDATE]
[DELETE]
Just missing the button UPDATE
I click on UPDATE to update the column and the codes
Go to Top of Page

RL
Starting Member

USA
15 Posts

Posted - 05/04/2012 :  16:51:12  Show Profile  Reply with Quote
Looks like the UPDATE applies the current value to all rows in the Clientes table. Since the final value is 12, all rows end up with that value.

Your SQL needs a WHERE clause to identify which row to update for each value. Something like this (VBA code may not be 100% correct):


cn.Execute "UPDATE Clientes Set Clientes.Codigo =('" & Worksheets("Plan1").Cells(i, 1).Value & "')
WHERE Clientes.Nome = ('" & Worksheets("Plan1").Cells(i, 2).Value & "')"

Go to Top of Page

Vassily Zaitsev
Starting Member

Brazil
13 Posts

Posted - 05/04/2012 :  17:12:12  Show Profile  Reply with Quote
You're the man, you helped me more
tava breaking head two weeks
I am more than eight hours working with VBA and was not able to solve this problem
a big hug my friend.
Thank you.
Go to Top of Page

RL
Starting Member

USA
15 Posts

Posted - 05/04/2012 :  17:21:11  Show Profile  Reply with Quote
You're welcome, glad I could help! -- RL
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.12 seconds. Powered By: Snitz Forums 2000