Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2004, 09:18 AM
Authorized User
 
Join Date: Jun 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default update query error

Hi all,

I have SQL server1 and SQL server2 and they are linked server to each other. I am from SQL server1 try the following query
Update server1.db1.DBO.table1
set
    [Salary Standard] = 66798,
    [Peer Group] = 'binh'
where
    position = ' B277'
and I got error
Server: Msg 8180, Level 16, State 1, Line 1
Statement(s) could not be prepared.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'Standard'.

Please help. What do I miss?
Thanks a lot
 
Old July 1st, 2004, 01:10 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

is there an error if you execute the query with out adding the server1 word

Ahmed Ali
Software Developer
 
Old July 1st, 2004, 09:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi khautinh,

When you want to update something in SERVER1, being connected to that, it is local to you, and you don't have to use SERVER1 reference there.

You can straight away use [b/Update DBO.table1[/b] if you use db1 as your current database. Only when you want to update any table on the remote server, you use that server referencing. But that shouldn't be causing you this error.

It is not a good practice to use SPACEs in the table/column name. It is better to remove the space in there and try updating.
Code:
Update table1
set
    Salary_Standard = 66798,
    Peer_Group = 'binh'
where position = 'B277'
This should work for you.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Query Error Tim Johnson Access 2 December 6th, 2007 02:57 PM
SQL Update query (error message) Neal SQL Server 2000 1 August 3rd, 2007 08:57 PM
UPDATE query throws error in selective MSI tables eelisMX General .NET 0 July 14th, 2005 06:29 AM
update query error in from clause [email protected] Classic ASP Databases 1 June 6th, 2005 06:02 AM
error in update query. feras Access ASP 1 May 2nd, 2005 07:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.