I got invalid column error
Here is simple code for your reference..
create or alter procedure proc_testing
as
begin
drop table testing
create table testing ([name] varchar(50))
insert into testing values ('testing')
IF NOT EXISTS (SELECT 1
FROM INFORMATION_SCHEMA.COLUMNS
WHERE upper(TABLE_NAME) = 'testing'
AND upper(COLUMN_NAME) = 'age')
BEGIN
ALTER TABLE [dbo].[Person] ADD age int
END
update testing set age=1
End
1条答案
按热度按时间gwo2fgha1#
Try this: