Sergey,
I could use your expertise here. This just isn't working:
DROP TABLE #temp
CREATE TABLE #temp (ch CHAR(1))
DECLARE @sTableName VARCHAR(MAX)
SET @sTableName = '#temp'
IF object_Id(@sTableName)is not null
EXEC('DROP TABLE ' + @sTableName)
CREATE TABLE #temp (ch CHAR(1))
Any idea what I'm doing wrong here?
>>How do you pass the parameter to Object_ID when the table name is being passed in?
>>
>
>
>CREATE FUNCTION dbo.fnTableExists
> (@sTableName VARCHAR(50))
>
>RETURNS TinyInt
>AS
>
>BEGIN
>
> RETURN CASE WHEN object_id(@sTableName) IS NOT NULL THEN 1 ELSE 1 END
>
>END
>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people