Hi,
I am fairly new to SQL, so not sure if this is just a SQL compiler thing or not. When I have used SQL before it's been through JAVA or PHP, never just straight SQL. I am using SQL Server 2005 and attempting to add a column to my table, and then populate it. Here is what I have now:
ALTER TABLE House DROP COLUMN CustomerType
ALTER TABLE House ADD CustomerType char(11)
UPDATE House
SET CustomerType = CASE
WHEN ... THEN...
WHEN ... THEN...
ELSE "Other"
END
However, when I try and compile this it errors since CustomerType in the UPDATE function hasn't been defined yet. Is there any way to run this so that it will compile and add the column and update it, or do I have to run it in multiple executes?
Thanks!