I wrote some SYbase sql to check if a column exists. If it does not exists I create a new column in the table. It almost works but something is wrong with my exec statement at line 3. When I try and run the code code block below I get an error message --> stored procedure '"ALTER TABLE dbo.customers ADD CustLoyalty VARCHAR(20)"' not found.
So can someone tell me what is wrong at line 3 below?
1 if not exists (select 1 from syscolumns where id= object_id('dbo.customers') and name = 'CustLoyalty')
3 exec "ALTER TABLE dbo.customers ADD CustLoyalty VARCHAR(20)"