Trying to build a function to see if table exists and if it doesn't then create that table!
Help would be greatly appreciated!
lots of ways...one of them:
if not exists (select 1 from sysobjects where name = @mytableparametername)
begin
create table ....
or you can also do a..
select * newtablename from blanktemplatetable
or
set @sqlstring = ('create table ' + @mytableparametername + '.....')
exec (@sqlstring)
or
set @sqlstring = ('select * into ' + @mytableparametername + ' from blanktemplatetable')
exec (@sqlstring)
end
this is obviously a pseudo-code...but i hope you get the idea...
-- CK