查询表是否存在的有关问题

查询表是否存在的问题泪奔。。。SQL codeexec(if(object_id(##tableName,u) is not null)begintruncate

查询表是否存在的问题
泪奔。。。

SQL code
exec('    if(object_id('##tableName','u') is not null)    begin       truncate '##tableName'    end    else    begin       create table ##tableName       (           whID,int       )    end')


这里明显有错!单引号嵌套!
但是,要怎么修改才能正确啊???
在线等解答。

[解决办法]
SQL code
exec('    if(object_id(''##tableName'',''u'') is not null)    begin       truncate table ##tableName    end    else    begin       create table ##tableName       (           whID int       )    end')