Is it possible to pass DDL statements as function parameters?

Something like this:

select MyAlterTable('Employees', add column CA name(250));
select MyAlterTable('Customers', add column CA name(250));

final statement would be:

alter table Employees
    add column CA name(250)

Or should I pass them as string and use execute command?

share
2  
Yes, you need to pass that as a string and use dynamic SQL. – a_horse_with_no_name Oct 5 '16 at 9:19
    
thanks @a_horse_with_no_name your help is much appreciated! – Tommy Oct 5 '16 at 9:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.