Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Thursday, March 22, 2012

Data Relationship & SQL data adapter

Hi

I was trying to fill SqlDataAdapter from a " View" with inner join of two tables. When I call the update method of the data adapter it is failing as it cannot generate automatic SQL for multiple tables in my view. Writing own SQL script for update is one way out but it is tedious process.

Is there any other work around to do this?

Can I create a view of two joined data sets on some condition (Just like creating a view in database) in the memory.

Cheers,

Sudath Attanayake.One option you might look into which is extremely common among database programmers, is to only do updates through stored procedures. One of the main reason is security. If you disalow any updates to hapen to the tables or views, then you can control who can update what by simply controlling the permission to execute the individual stored procs, or special case what data can be updated.

Tuesday, March 20, 2012

data recovery problem: need help with sp_attach_db

Hello, The short story is that we were trying to update to windows
2000 sp4 and the server was corrupted. It would not boot. So, we
reinstalled the OS and SQL Server 7. Now, I have one MDF
file/database which I need to reattach. How do I do this? I've been
reading about sp_attach_db and sp_attach_single_file_db so I know that
it's possible but I need a quick step-by-step as to how to access the
command line and what to do, caveats, etc. I'd like to have things
back up and running by Monday AM so if there is a gentle reader who
sees this cry for help and can send me an email concerning the fix I
would greatly appreciate it. THANKS!
Eben Yong
eben_yong@.hpsm.org <--work (I prefer responses, here)
yonglove@.yahoo.com <--personalIf you only have the data file, you might get lucky with
sp_attach_single_file_db. For example:
EXEC sp_attach_single_file_db
'MyDatabase',
'C:\MyDataFiles\MyDatabase.mdf'
Depending on the state database at the time of the crash, the attach may
fail because the data file is inconsistent and the log file is required.
In this case, I suggest you restore from backup if possible. If you
have no backup, contact Microsoft PSS.
If the database attaches successfully, you'll need to recreate logins
and remap database. You can use sp_change_users_login to facilitate
this. See the Books Online for details on using these stored procs.
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Eben Yong" <yonglove@.yahoo.com> wrote in message
news:b9393494.0309131949.86e62f5@.posting.google.com...
> Hello, The short story is that we were trying to update to windows
> 2000 sp4 and the server was corrupted. It would not boot. So, we
> reinstalled the OS and SQL Server 7. Now, I have one MDF
> file/database which I need to reattach. How do I do this? I've been
> reading about sp_attach_db and sp_attach_single_file_db so I know that
> it's possible but I need a quick step-by-step as to how to access the
> command line and what to do, caveats, etc. I'd like to have things
> back up and running by Monday AM so if there is a gentle reader who
> sees this cry for help and can send me an email concerning the fix I
> would greatly appreciate it. THANKS!
> Eben Yong
> eben_yong@.hpsm.org <--work (I prefer responses, here)
> yonglove@.yahoo.com <--personal|||I tried it, but it didn't work... help!! Am I 'stuck'?
exec sp_attach_single_file_db @.dbname = 'eVision_Data', @.physname ='E:\MSSQL7\DATA\eVision_Data.MDF'
Server: Msg 945, Level 14, State 2, Line 1
Database 'eVision_Data' cannot be opened because some of the files
could not be activated.
Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'eVision_Data'. CREATE DATABASE is
aborted.
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message news:<#UnLjVneDHA.3896@.tk2msftngp13.phx.gbl>...
> If you only have the data file, you might get lucky with
> sp_attach_single_file_db. For example:
> EXEC sp_attach_single_file_db
> 'MyDatabase',
> 'C:\MyDataFiles\MyDatabase.mdf'
>|||> I tried it, but it didn't work... help!! Am I 'stuck'?
Yes. I suggest you restore from backup if possible. If you have no
backup, contact Microsoft PSS.
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Eben Yong" <yonglove@.yahoo.com> wrote in message
news:b9393494.0309150616.48445f1e@.posting.google.com...
> I tried it, but it didn't work... help!! Am I 'stuck'?
> exec sp_attach_single_file_db @.dbname = 'eVision_Data', @.physname => 'E:\MSSQL7\DATA\eVision_Data.MDF'
> Server: Msg 945, Level 14, State 2, Line 1
> Database 'eVision_Data' cannot be opened because some of the files
> could not be activated.
> Server: Msg 1813, Level 16, State 2, Line 1
> Could not open new database 'eVision_Data'. CREATE DATABASE is
> aborted.
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:<#UnLjVneDHA.3896@.tk2msftngp13.phx.gbl>...
> > If you only have the data file, you might get lucky with
> > sp_attach_single_file_db. For example:
> >
> > EXEC sp_attach_single_file_db
> > 'MyDatabase',
> > 'C:\MyDataFiles\MyDatabase.mdf'
> >sql

Data Read-Consistency During Update

Hi folks,

I have 3 tables of related data in SQL 2000/2005 that receive periodic adds/updates every 30 seconds.

I have enabled transactions on all updates, is anything else needed to ensure data consistency during reads in a high # of fetches per second situation?

Thanks,

john

Edit:

Clarification -- I just need the data to be correctly displayed to all users.

Hi,

I am not sure what do you mean by consistency. You may need to change transaction isolation level. Setting "serializable" level ensures complete consistency, but may impact performance of your server.

-yuriy
http://weblogs.asp.net/ysolodkyy

|||

Thanks, that's what I was describing.

Thursday, March 8, 2012

data mixed up after update

Hi!

I have quite strange problem, that I haven't seen before.

When I use update command:

UPDATE categorys SET banner_valid= '0', section_id= '1', main_cat_default= '0', banner= '', b_link= '', external_text= 'Nākotnes parks ', in_frontpage= '1', name = '100. pants' WHERE (id = 130)

Then the field EXTERNAL_TEXT should have value Nākotnes parks but instead of this it makes it Nakotnes parks.

I changed collation to Latvian and this did not work.

But!!! When I open Enterprise manager and just type in Nākotnes parks and save it then it is ok, but it does not work with Update/add script

Any help or ideas?

I would try changing Asp.net to UTF16, maybe Latvian is only UTF 16. That maybe the reason it works in Enterprise manager and not in your application. SQL Server Unicode is multibyte UTF16 while .NET you have the option of using singlebyte UTF8. Hope this helps.

Kind regards,

Gift Peddie

|||You need to tell SQL Server that you're submitting Unicode text by giving your string the N prefix:
UPDATE categorys
SET banner_valid= '0',section_id= '1', main_cat_default= '0', banner= '', b_link= '',external_text= N'Nākotnes parks ', in_frontpage= '1', name = '100.pants'
WHERE id = 130
|||

SQL Server Unicode is multibyte UTF16


Actually it's not. It's UCS2, which is a fixed-length encoding.

you have the option of using singlebyte UTF8


UTF-8 is a variable-length encoding, so a given character encoded with UTF-8 *may* only require a single byte, or it may require two bytes, or four. It can represent anything that you can store in UCS2 just fine.

Saturday, February 25, 2012

Data manipulation with One-to-many-to-one relationship

Is it possible to INSERT, UPDATE, DELETE data in this type of relationship? If so, how in VS2005? Not having issues with SELECT, even without joins.

Thanks

Hi,

Try providing more information about what you are trying to do. Do you have tables set up in a DB already? What columns do you have in those tables, and what are the references that make a given row of data in each table unique (primary keys)?

If you don't have a schema yet, provide (in your own words), what facts you are trying to convey - such as 'A customer places an order. Order has line items. Each product has a product number.' etc... This will give viewers here a better understanding of what you need.

Good luck, in any event. BRN..

|||

Let's say for example:

Table 1 has Table1ID (PK) and Table1Data

Table 2 has Table2ID (PK), Table1ID (FK for Table1.Table1ID), Table3ID (FK for Table3.Table3ID)

Table 3 has Table3ID (PK), and Table3Data

Relationship is one-to-many for Table1.Table1ID to Table2.Table1ID and one-to-many for Table3.Tat.ble3ID to Table2.Table3ID, creating a many to many relationship for Table1 to Table 3 using Table 2 as an intersection table. I do not have any cascading.

I am able to query the database and gather the information, but need to be able to add, edit, and delete in a C# VS2005 project. Starting off small with something like this would enable me to conquer a bigger project that I would like to create. This is the first time I have had to work with data that required this type of relationship.

I'd prefer to see the SQL.

Is this enough information?

Many thanks

|||OK, let take these 3 tables for example:

create table Employee (EmplNumber int not null primary key,EmplName nvarchar(20) not null)

create table Department (DeptNumber int not null primary key,DeptName nvarchar(50) not null)

-- relationship between Employee and Department

create table DeptEmpl (DeptNumber int not null foreign key references Department(DeptNumber)
ON DELETE CASCADE ON UPDATE CASCADE,
EmplNumber int not null foreign key references Employee(EmplNumber)
ON DELETE CASCADE ON UPDATE CASCADE)

insert into Employee values (1, 'John')
insert into Employee values (2, 'Terry')
insert into Employee values (3, 'Andrew')

insert into Department values (1, 'Marketing')
insert into Department values (2, 'Sales')
insert into Department values (3, 'Accounting')

insert into DeptEmpl values (1, 1)
insert into DeptEmpl values (1, 3)
insert into DeptEmpl values (2, 1)
insert into DeptEmpl values (2, 2)
insert into DeptEmpl values (2, 3)
insert into DeptEmpl values (3, 1)

?
There should be no problem when you try to insert data-- the PK/FK contraint will maintain the reference integrity for you. The key point here is theON DELETE/UPDATE CASCADE, they will help to maintain reference integrity during DELETE/UPDATE, so no extra work need to be done manually. If you have other concerns, feel free to post themSmile|||

Thanks Iori_Jay

It is completely clear to me what you are doing in this example. How does one handle user input variables from a web application?

Let's say the user wants to insert a new Employee 'Edgar' that belongs to Department 'Sales'.

|||OK, typical steps for such INSERT should be:

1. Insert the information for the new employee 'Edgar' toEmployee table, and get theEmplNumber for the new inserted employee
2. Check theDepartment table to see whether there is a 'Sales' department, if not then add the 'Sales' department.
3. Insert a row toDeptEmpl table to represent the relationship between 'Edgar' and 'Sales'.

So a sample stored procedure looks like:

CREATE PROCEDURE usp_InsertNewEmployee @.EmpName nvarchar(20), @.DeptName nvarchar(50)
AS
IF((LEN(@.EmpName)=0) OR (LEN(@.DeptName)=0))
RAISERROR('Please input both Employee name and the department name which he(she) belongs to',16,1)
DECLARE @.newEmpNumber INT,@.DeptNumber INT
SELECT @.newEmpNumber=max(EmplNumber)+1 FROM Employee
SELECT @.DeptNumber=DeptNumber FROM Department WHERE DeptName=@.DeptName

INSERT INTO Employee SELECT @.newEmpNumber, @.EmpName
IF (@.DeptNumber IS NULL)
BEGIN
SELECT @.DeptNumber=max(DeptNumber)+1 FROM Department
INSERT INTO Department SELECT @.DeptNumber,@.DeptName
END
INSERT INTO DeptEmpl SELECT @.newEmpNumber,@.DeptNumber
go

EXEC usp_InsertNewEmployee 'Edgar','Sales'|||

Iori_jay,

Thanks so much for your help. I've learned many things from this post. I appreciate you sharing your talents.

ICE|8

|||It's my pleasure to help with this issueSmile Wish you a happy festival!

Sunday, February 19, 2012

Data insertion

Hello,

My project is to update a price table with a text file.
But sometimes, there are new refs in text file that are not in my ref table.

How can i check it and automate the insertion of those new refs

Thanks a lotThe LOOKUP component can tell you what rows in the pipeline are not in the lookup table by setting the component to redirect all rows not found in the target to the error output. There's an explanation of this at http://www.sqlis.com/default.aspx?311

-Jamie

Friday, February 17, 2012

data import question

Hi,
I am writing a script for a client to update TableA using the data in
TableB. I know how to write an UPDATE query to do this. But the client wants
an ability to add or remove fields that they update using this script. I
know I can do this by letting the client enter the names of the source and
destination fields in a custom table and generate a dynamic query to update
the provided columns. But the problem is there are large number of fields
and sql has the limit of 8000 characters on variables write a dynamic query.
So writing a dynamic query is not an easy option either. So my question is
how do I solve this problem. Please not that we need to update 150+ fields
in 500,000+ records using this script. So it also needs to be as fast as
possible.
Thanks in advance.helpful sql wrote:

> Hi,
> I am writing a script for a client to update TableA using the data in
> TableB. I know how to write an UPDATE query to do this. But the client wan
ts
> an ability to add or remove fields that they update using this script. I
> know I can do this by letting the client enter the names of the source and
> destination fields in a custom table and generate a dynamic query to updat
e
> the provided columns. But the problem is there are large number of fields
> and sql has the limit of 8000 characters on variables write a dynamic quer
y.
> So writing a dynamic query is not an easy option either. So my question is
> how do I solve this problem. Please not that we need to update 150+ fields
> in 500,000+ records using this script. So it also needs to be as fast as
> possible.
> Thanks in advance.
Here's one possibility:
UPDATE A
SET
col1 = CASE WHEN @.col1 = 'Y' THEN B.col1 ELSE A.col1 END,
col2 = CASE WHEN @.col2 = 'Y' THEN B.col2 ELSE A.col2 END,
col3 = CASE WHEN @.col3 = 'Y' THEN B.col3 ELSE A.col3 END
..
WHERE ...?
David Portas
SQL Server MVP
--|||Dynamic SQL can take several variables to exceed the 8000 byte limit.
DECLARE @.X1 VARCHAR(8000), @.X2 VARCHAR(8000)
EXEC(@.X1 + @.X2)
Andrew J. Kelly SQL MVP
"helpful sql" <nospam@.stopspam.com> wrote in message
news:eC2Vg$IDGHA.3748@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I am writing a script for a client to update TableA using the data in
> TableB. I know how to write an UPDATE query to do this. But the client
> wants an ability to add or remove fields that they update using this
> script. I know I can do this by letting the client enter the names of the
> source and destination fields in a custom table and generate a dynamic
> query to update the provided columns. But the problem is there are large
> number of fields and sql has the limit of 8000 characters on variables
> write a dynamic query. So writing a dynamic query is not an easy option
> either. So my question is how do I solve this problem. Please not that we
> need to update 150+ fields in 500,000+ records using this script. So it
> also needs to be as fast as possible.
> Thanks in advance.
>

Tuesday, February 14, 2012

Data from Excel into SQL

Please excuse the cross posting I was not sure which newsgroup would produce
the required advice.
I have a requirement to update a SQL table with data from an Excel
worksheet.
Can anyone suggest the best way to do this...ADO??
PWS
There are numerous variables here. Is this a one-time requirement, or an on-going need? Do you
want to write a program, or just use a utility? If programming, what languages are you open to
using?
"Paul Smith" <pws@.twelve.me.uk> wrote in message
news:42ea3c7c$0$3509$ed2619ec@.ptn-nntp-reader03.plus.net...
> Please excuse the cross posting I was not sure which newsgroup would produce the required advice.
> I have a requirement to update a SQL table with data from an Excel worksheet.
> Can anyone suggest the best way to do this...ADO??
> PWS
>
|||ADO is a great way - IMHO. There are many others too. If you fancy
taking the ADO route here's a few useful links:
'Exhaustive list of objects, properties, methos etc.
http://www.devguru.com/Technologies/...cts_index.html
'getting started
http://msdn.microsoft.com/library/de...tml/sqlado.asp
'a good FAQ for commonly experienced problems - beats waiting for
replies on an NG!
http://www.oblique.ch/ms/ADO_Faq.html
And here's some sample code to get you started. Note, there's many ways
to work with ADO and Access - I use RecordSet to retrieve data and
Command to insert or update. Seems to work ok...
HTH
Gareth
'--
Private Const myDBConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0"
Private Const myDBLocation As String = "C:\myDB.mdb"
Private rs As ADODB.Recordset
Private cn As ADODB.Connection
'Once we've opened a connection we leave it open!
'This is closed upon closing the workbook.
Private Function fcnConnectToDB() As Boolean
'Check whether the connection is already open.
If Not cn Is Nothing Then
If cn.State <> adStateClosed Then
fcnConnectToDB = True
Exit Function
End If
End If
'Open connection the database
Set cn = New ADODB.Connection
With cn
.Errors.Clear
On Error Resume Next
.CursorLocation = adUseClient
.connectionString = myDBConnectionString
.Open myDBLocation
On Error GoTo 0
If .Errors.Count = 0 Then fcnConnectToDB = True
End With
End Function
'
'Returns False if there was a error
'Else returns array containing of returned records
Public Function ADO_RunQuery(mySQL As String) As Variant
'Check we're connected to the database
fcnConnectToDB
'Open the recordset.
Set rs = New ADODB.Recordset
With rs
.ActiveConnection = cn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockPessimistic 'adLockBatchOptimistic
.Open mySQL 'cmd
End With
'Dump the record set into an array
If rs.RecordCount = 0 Then
ADO_RunQuery = False
Else
ADO_RunQuery = rs.GetRows
End If
rs.Close
'tidy up
Set rs = Nothing
'(We leave the connection permanently open - you may like to
' close it afterwards)
End Function
Public Function ADO_UpdateDB(mySQL As String) As Boolean
'Check we're connected to the database
fcnConnectToDB
'Set the command text and execute
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = cn
.CommandText = mySQL
.CommandType = adCmdText
On Error Resume Next
.Execute
If Err.Number = 0 Then ADO_UpdateDB = True
On Error GoTo 0
End With
'tidy up
Set cmd = Nothing
'(We leave the connection permanently open)
End Function
Paul Smith wrote:
> Please excuse the cross posting I was not sure which newsgroup would produce
> the required advice.
> I have a requirement to update a SQL table with data from an Excel
> worksheet.
> Can anyone suggest the best way to do this...ADO??
> PWS
>
|||This might be a help for getting data to and from Excel and Access: It
includes examples of using variables in SQL queries.
http://www.bygsoftware.com/examples/sql.html
Or you can get there from the "Excel with Access Databases" section on page:
http://www.bygsoftware.com/examples/examples.htm
It demonstrates how to use SQL in Excel's VBA to:
* create a database,
* create a table
* insert records
* select records,
* update records,
* delete records,
* delete a table,
* delete a database.
DAO and ADO files available.
You can also download the demonstration file called "excelsql.zip".
The code is open and commented.
Andy Wiggins FCCA
www.BygSoftware.com
Excel, Access and VBA Consultancy
-
"Paul Smith" <pws@.twelve.me.uk> wrote in message
news:42ea3c7c$0$3509$ed2619ec@.ptn-nntp-reader03.plus.net...
> Please excuse the cross posting I was not sure which newsgroup would
produce
> the required advice.
> I have a requirement to update a SQL table with data from an Excel
> worksheet.
> Can anyone suggest the best way to do this...ADO??
> PWS
>
|||I found the chicken vindaloo recipe particularly useful too - made it,
ate it, loved it. Thanks
Andy Wiggins wrote:
> This might be a help for getting data to and from Excel and Access: It
> includes examples of using variables in SQL queries.
> http://www.bygsoftware.com/examples/sql.html
> Or you can get there from the "Excel with Access Databases" section on page:
> http://www.bygsoftware.com/examples/examples.htm
> It demonstrates how to use SQL in Excel's VBA to:
> * create a database,
> * create a table
> * insert records
> * select records,
> * update records,
> * delete records,
> * delete a table,
> * delete a database.
> DAO and ADO files available.
> You can also download the demonstration file called "excelsql.zip".
> The code is open and commented.
>

Data from Excel into SQL

Please excuse the cross posting I was not sure which newsgroup would produce
the required advice.
I have a requirement to update a SQL table with data from an Excel
worksheet.
Can anyone suggest the best way to do this...ADO'?
PWSThere are numerous variables here. Is this a one-time requirement, or an on
-going need? Do you
want to write a program, or just use a utility? If programming, what langua
ges are you open to
using?
"Paul Smith" <pws@.twelve.me.uk> wrote in message
news:42ea3c7c$0$3509$ed2619ec@.ptn-nntp-reader03.plus.net...
> Please excuse the cross posting I was not sure which newsgroup would produ
ce the required advice.
> I have a requirement to update a SQL table with data from an Excel workshe
et.
> Can anyone suggest the best way to do this...ADO'?
> PWS
>|||ADO is a great way - IMHO. There are many others too. If you fancy
taking the ADO route here's a few useful links:
'Exhaustive list of objects, properties, methos etc.
http://www.devguru.com/Technologies...ects_index.html
'getting started
http://msdn.microsoft.com/library/d...
ado.asp
'a good FAQ for commonly experienced problems - beats waiting for
replies on an NG!
http://www.oblique.ch/ms/ADO_Faq.html
And here's some sample code to get you started. Note, there's many ways
to work with ADO and Access - I use RecordSet to retrieve data and
Command to insert or update. Seems to work ok...
HTH
Gareth
'--
Private Const myDBConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0"
Private Const myDBLocation As String = "C:\myDB.mdb"
Private rs As ADODB.Recordset
Private cn As ADODB.Connection
'Once we've opened a connection we leave it open!
'This is closed upon closing the workbook.
Private Function fcnConnectToDB() As Boolean
'Check whether the connection is already open.
If Not cn Is Nothing Then
If cn.State <> adStateClosed Then
fcnConnectToDB = True
Exit Function
End If
End If
'Open connection the database
Set cn = New ADODB.Connection
With cn
.Errors.Clear
On Error Resume Next
.CursorLocation = adUseClient
.connectionString = myDBConnectionString
.Open myDBLocation
On Error GoTo 0
If .Errors.Count = 0 Then fcnConnectToDB = True
End With
End Function
'
'Returns False if there was a error
'Else returns array containing of returned records
Public Function ADO_RunQuery(mySQL As String) As Variant
'Check we're connected to the database
fcnConnectToDB
'Open the recordset.
Set rs = New ADODB.Recordset
With rs
.ActiveConnection = cn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockPessimistic 'adLockBatchOptimistic
.Open mysql 'cmd
End With
'Dump the record set into an array
If rs.RecordCount = 0 Then
ADO_RunQuery = False
Else
ADO_RunQuery = rs.GetRows
End If
rs.Close
'tidy up
Set rs = Nothing
'(We leave the connection permanently open - you may like to
' close it afterwards)
End Function
Public Function ADO_UpdateDB(mySQL As String) As Boolean
'Check we're connected to the database
fcnConnectToDB
'Set the command text and execute
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = cn
.CommandText = mySQL
.CommandType = adCmdText
On Error Resume Next
.Execute
If Err.Number = 0 Then ADO_UpdateDB = True
On Error GoTo 0
End With
'tidy up
Set cmd = Nothing
'(We leave the connection permanently open)
End Function
Paul Smith wrote:
> Please excuse the cross posting I was not sure which newsgroup would produ
ce
> the required advice.
> I have a requirement to update a SQL table with data from an Excel
> worksheet.
> Can anyone suggest the best way to do this...ADO'?
> PWS
>|||This might be a help for getting data to and from Excel and Access: It
includes examples of using variables in SQL queries.
http://www.bygsoftware.com/examples/sql.html
Or you can get there from the "Excel with Access Databases" section on page:
http://www.bygsoftware.com/examples/examples.htm
It demonstrates how to use SQL in Excel's VBA to:
* create a database,
* create a table
* insert records
* select records,
* update records,
* delete records,
* delete a table,
* delete a database.
DAO and ADO files available.
You can also download the demonstration file called "excelsql.zip".
The code is open and commented.
Andy Wiggins FCCA
www.BygSoftware.com
Excel, Access and VBA Consultancy
-
"Paul Smith" <pws@.twelve.me.uk> wrote in message
news:42ea3c7c$0$3509$ed2619ec@.ptn-nntp-reader03.plus.net...
> Please excuse the cross posting I was not sure which newsgroup would
produce
> the required advice.
> I have a requirement to update a SQL table with data from an Excel
> worksheet.
> Can anyone suggest the best way to do this...ADO'?
> PWS
>|||I found the chicken vindaloo recipe particularly useful too - made it,
ate it, loved it. Thanks
Andy Wiggins wrote:
> This might be a help for getting data to and from Excel and Access: It
> includes examples of using variables in SQL queries.
> http://www.bygsoftware.com/examples/sql.html
> Or you can get there from the "Excel with Access Databases" section on pag
e:
> http://www.bygsoftware.com/examples/examples.htm
> It demonstrates how to use SQL in Excel's VBA to:
> * create a database,
> * create a table
> * insert records
> * select records,
> * update records,
> * delete records,
> * delete a table,
> * delete a database.
> DAO and ADO files available.
> You can also download the demonstration file called "excelsql.zip".
> The code is open and commented.
>