Hi,
Is there a way to update a table without specifying the columns to be
updated?
I have a backup of the table which i join on a id. All columns are the
same, but there are more than 100. So if i can create a statement like
you can for an insert, it would be great.
The backup table resides on a different server, so i also use the
openquery method to get the records.
Is this possible what i want?>Is there a way to update a table without specifying the columns to be
>updated?
NO.
You can probably use some smart T-SQL to create the satements
Roji. P. Thomas
Net Asset Management
http://toponewithties.blogspot.com
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:%23X04bLcmFHA.3120@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Is there a way to update a table without specifying the columns to be
> updated?
> I have a backup of the table which i join on a id. All columns are the
> same, but there are more than 100. So if i can create a statement like you
> can for an insert, it would be great.
> The backup table resides on a different server, so i also use the
> openquery method to get the records.
> Is this possible what i want?|||You don't need to use OPENQUERY if both servers are SQL Server. Just
use the four-part name:
server.database.dbo.table
You have to list the columns in a UPDATE statement. You should do in an
INSERT too - in the long term it makes your code much more reliable and
easier to support. Really, it isn't a problem because you can drag the
list of columns from the Object Browser in Query Analyzer without
typing a thing. It should only be the work of a few seconds to create
your UPDATE statement.
David Portas
SQL Server MVP
--|||Hi David,
I thought it couldn't be done. Anyway i used the four-part name method,
but that didn't work for that specifically database. All other databases
on that server will work. Do you know why, all permissions and other
stuff are correct. The only thing i can see, is the logic filename
differs from the databasename.
David Portas wrote:
> You don't need to use OPENQUERY if both servers are SQL Server. Just
> use the four-part name:
> server.database.dbo.table
> You have to list the columns in a UPDATE statement. You should do in an
> INSERT too - in the long term it makes your code much more reliable and
> easier to support. Really, it isn't a problem because you can drag the
> list of columns from the Object Browser in Query Analyzer without
> typing a thing. It should only be the work of a few seconds to create
> your UPDATE statement.
>|||>>but that didn't work for that specifically database
Means what?
Are you getting an Error back?
Then please post the error.
Roji. P. Thomas
Net Asset Management
http://toponewithties.blogspot.com
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:u0sNoxcmFHA.1464@.TK2MSFTNGP14.phx.gbl...
> Hi David,
> I thought it couldn't be done. Anyway i used the four-part name method,
> but that didn't work for that specifically database. All other databases
> on that server will work. Do you know why, all permissions and other stuff
> are correct. The only thing i can see, is the logic filename differs from
> the databasename.
> David Portas wrote:|||Hi,
This is the errormessage:
Invalid schema or catalog specified for provider 'SQLOLEDB'.
Friday, March 9, 2012
large updatestatement
Labels:
backup,
beupdatedi,
columns,
database,
microsoft,
mysql,
oracle,
server,
specifying,
sql,
table,
update,
updatestatement
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment