Wrox Programmer Forums
|
BOOK: Professional SQL Server 2000 Programming
This is the forum to discuss the Wrox book Professional SQL Server 2000 Programming by Robert Vieira; ISBN: 9780764543791
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional SQL Server 2000 Programming 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 February 7th, 2004, 11:45 AM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Query Analyser

This is a problem I'm having with 'Beginning SQL Programming' (which I can;t see listed on this site anywhere...?)

Exercise at Chapter 6, P.179 instructs you to use the code:

ALTER TABLE InsurPlans
ALTER FIELD InsurPlanName VARCHAR(20);

via the Query Analyser to change the InsurPlanName field Data Type.

However, I'm getting the response:

Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near 'FIELD'.

Fairly sure I'm not making a typo!!

Any ideas?



 
Old February 7th, 2004, 12:31 PM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmm...If I replace the word FIELD with COLUMN it goes through fine.

 
Old November 14th, 2004, 01:29 PM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to saleyoun@hotmail.com Send a message via MSN to saleyoun@hotmail.com Send a message via Yahoo to saleyoun@hotmail.com
Default


Mithrandir,

Try replacing the word FIELD with the word COLUMN

ALTER TABLE InsurPlans
ALTER COLUMN InsurPlanName VARCHAR(20);




 
Old December 4th, 2004, 07:15 AM
Authorized User
 
Join Date: Nov 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ALTER TABLE InsurPlans
ALTER COLUMN InsurPlanName VARCHAR(20);


 
Old June 8th, 2005, 03:45 AM
Authorized User
 
Join Date: Mar 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you should change ALTER FIELD to ALTER COLUMN.

The code should be:

ALTER TABLE InsurPlans
ALTER COLUMN InsurPlanName VARCHAR(20);


 
Old November 21st, 2005, 07:05 PM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How would you alter multiple columns? I cad add and drop columns without any errors, but when I try to ALTER COLUMN multiple columns, I get an error:

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'COLUMN'.

Here is my code:

Conn.Execute " ALTER TABLE tblAccts ALTER COLUMN contAddr2 NVARCHAR(255) "&_
                    " ALTER COLUMN contCity NVARCHAR(150)"

I tried separating columns by commas, semicolons and spaces, but nothing seems to be working.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
Alternative to Query Analyser ioates SQL Server 2000 3 August 24th, 2005 09:47 AM
Show Query Analyser in VS.NET Raif VS.NET 2002/2003 1 July 14th, 2004 05:08 PM





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