This physically alters a table not a query - do you mean table or query Ryan? - if you mean query then just add the column name to the table. If you mean table then I try to steer clear of Alter table. What I tend to do is write an SP which creates a temp table of the old structure of your table and copy's all of the table across, then drops the table, recreates it with the new columns/restraints/permissions/index's etc... and then copies the data back across. Sounds like overkill I know but a very experienced DBA taught me to stay away from alter tables - can't remember why.......
-----Original Message----- From: Adrian Lynch [mailto:[EMAIL PROTECTED]] Sent: 20 May 2002 16:26 To: CF-Talk Subject: RE: OT (SQL): Add column to query? ALTER TABLE table_name ADD column_name datatype Or ALTER TABLE table_name DROP COLUMN column_name -----Original Message----- From: Ryan Pieszak [mailto:[EMAIL PROTECTED]] Sent: 20 May 2002 16:13 To: CF-Talk Subject: OT (SQL): Add column to query? I know this is OT, but I've seen some SQL on this list lately, so I figured I ask: Let's say I have this query: Col1 Col2 Col3 1 a 10 2 b 11 3 c 12 4 d 13 5 e 14 6 f 15 But I'd like to add a column to this query later in the process, so I'd have this: Col1 Col2 Col3 myCol 1 a 10 24 2 b 11 24 3 c 12 24 4 d 13 24 5 e 14 24 6 f 15 24 Is there a queryAppend, or something I can use to add a column to a query in MSSQL? If it makes a difference, every value in the added column will be the same. Thanks for any help. Ryan ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists