Using Synonym in SQL Server 2008 R2 (Create and detect existence of a table) -


is there way create table on sql server 2008 r2 referencing table name synonym? how can detect if object (the base object) existing in database synonym?

i've discovered can create synonym object not exist in database. kind of weird. might useful implementation i'm trying do.

so if need create table named dbo.customer, want following-

/* table dbo.customer has not been created in database yet */ create synonym customer_synonym dbo.customer  /* know lines below give wrong result (the object_id detection part)  * , error (the create table part), cause i've tried it.  * want know if there simple work around  */ if object_id(n'customer_synonym') not null create table customer_synonym (     cust_id int not null     , cust_name varchar(100) not null     ...     ... ); 

any or suggestion appreciated. thanks.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -