Create Public Synonym
Jul 15, 2006
I get an error in query analyzer when running (parsing query):
CREATE PUBLIC SYNONYM LIB_GROUP_PERMITS FOR LIB_GROUP_PERMITS;
with an error of:
"Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'PUBLIC'."
Can anyone help me at all please!
Thanks!
View 3 Replies
ADVERTISEMENT
Apr 16, 2015
I'm using SQL Server 2008R2. I am developing a database which requires access to data from other servers. So far I have been creating views using OPENQUERY (where there's a performance benefit) to select specifically the columns I want. Generally, for my purposes, I find these OPENQUERY based views to perform better (some times significantly so) to simple SELECT <COLUMNS> FROM <SERVER>.<DATABASE>.<SCHEMA>.<TABLE> WHERE <Where clause Statements> format views. My understanding is that this is because an OPENQUERY "pushes" the query processing to the remote server and simply returns the final result set to the local server i.e. there's no cross-server join/synchronization going on.
My question is, if I were to create a Synonym for a table object on the remote server, where does the processing happen if I query from this Synonym or create a join with this synonym to a table in my local database?Essentially, I am trying to understand if there are any "hidden gotcha's" primarily from a performance perspective, to using synonyms.
View 1 Replies
View Related
Apr 23, 2015
A heavily-selected database will be in an inconsistent state for several hours during a batch process. For that time, a database snapshot is created and accessed instead. To allow constant client read access to the database, a database that only contains synonyms exists. Those synonyms point to the main database except during the batch process, at which time they point to the database snapshot.
To switch the synonyms, each synonym is dropped and then created pointing to the database snapshot (after its creation, of course). The drop/create occurs inside a transaction. Roughly, the SQL looks like this:
SET XACT_ABORT ON;
BEGIN TRANSACTION;
DROP SYNONYM [dbo].[some_proc];
CREATE SYNONYM [dbo].[some_proc] FOR [snapshot_db].[dbo].[some_proc];
GRANT EXECUTE, SELECT ON [dbo].[some_proc] TO public;
COMMIT TRANSACTION;
When the batch update is completed, the process is reversed with "snapshot_db" replaced with "regular_db". The SQL snippet above is dynamic SQL. What I've pasted is the dynamic SQL that is executed as a single batch.
While this switch is happening, clients are accessing the procedures through the synonyms, potentially at a high request rate. Testing reveals that clients can get the error:
Error=-2147217900, Id=0, Meaning=IDispatch error #3092,
Source=Microsoft OLE DB Provider for ODBC Drivers,
Description=[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'dbo.some_proc'.
This error only occurs once. If the same SPID retries its request and the transaction has not completed (for testing, a delay was added), then it blocks until the transaction completes.
Any way to prevent it besides a client-side retry?
View 2 Replies
View Related
Jul 20, 2007
I use the following script in order to create db role:
USE [MyDB]GOCREATE ROLE [myRole] AUTHORIZATION [public]GO
It doesn't work:
Msg 15405, Level 16, State 1, Line 1
Cannot use the special principal 'public'.
However this code works fine:
USE [MyDB]GOCREATE ROLE [myRole] AUTHORIZATION [dbo]GOALTER AUTHORIZATION ON ROLE::[myRole] TO [public]GO
So the question is why?
View 6 Replies
View Related
Feb 23, 2001
I'm trying to get a SQL 7 and 6.5 DB to interact, but while there is no problem in SQL7, I cannot create a table called "Public" or a field called "Primary"!!
Does anyone know why this might be and if so where I might get a list of any other "invalid" names??
Thanks in advance,
Damon
View 1 Replies
View Related
Jul 10, 2007
how can I create a database synonym for the actual database name?
View 3 Replies
View Related
Oct 4, 2006
Is it possible to create a SYNONYM that does not require you to use the owner prefix? Similar to an Oracle PUBLIC synonym.
for example:
CREATE SYNONM MySynonym FOR dbo.myfunction.
SELECT MySynonym FROM dbo.mytable;
View 3 Replies
View Related
Apr 12, 2006
Suppose that a synonym foobar exists pointing to the table foo.bar. I also have a table with the same name in my schema. (mpswaim.foobar)
If I do a select
select * from foobar
Which table does the select run against? mpswaim.foobar, or foo.bar?
In Oracle, mpswaim.foobar would win, and we used this to all ow individual developers to have their own version of application tables during development.
View 1 Replies
View Related
Apr 28, 2004
Hi all. Informix and DB2 support something called synonyms that allow you to basically create sort of an alias for a table at the database level. Think of it sort of as a shortcut or link to a table. Does SQL Server 2000 have a similar ability and if so how?
I know someone will ask why you want to do this, so heres a quick example:
If you have one legacy application that expects to write to one particualr table, but you wish to partition that table across several tables, you can break table1 up into tablea,tableb,tablec and then create a synonym called table1 that would point to only the appropriate table at the appropriate time. This way you can break a huge HUGE table up into logically discreet smaller tables and manage the creation of the appropriate synonym in some wrapper that sits in front of the legacy application...thus allowing you to retool a table that has outgrown its original design without having to crack open dreaded legacy code.
So, anyone?
View 1 Replies
View Related
Feb 25, 2008
I ran the following command to create a synonym for a function -
create synonym testfunc for myschema.myfunc
Then testfunc will be created in the dbo schema. When I call this function from my stored procedure by 'testfunc', I received an error indicating 'testfunc' is not a recognized build-in function name. If I call it by 'dbo.testfunc' then it will work.
If I create a synonym for a table, I can access the table using the synonym in my stored procedure without any problem.
Is it true that synonym works differently on tables vs. functions?
View 4 Replies
View Related
Oct 23, 2006
I may just be completely missing something here but, when I view a query plan from a SQL statment that involves a join with a synonym I do not see any reference to the synonym or the underlying table referenced by it in the query plan? Any thoughts?
Thx!
View 5 Replies
View Related
Aug 15, 2006
Can anyone tell me why I am getting this error when I try to select * from a table through a newly created synonym? I have admin rights to both db, but they are on separate servers.
<Error>
OLE DB provider "SQLNCLI" for linked server "srvDEV" returned message "Communication link failure".
Msg 10054, Level 16, State 1, Line 0
TCP Provider: An existing connection was forcibly closed by the remote host.
Msg 18456, Level 14, State 1, Line 0
Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.
</error>
<code>
CREATE SYNONYM ARContractTerms_syn FOR srvDEV.EricsAdeptCastle.dbo.tblARContractTerms
SELECT * FROM ARContractTerms_syn
</code>
Am I running into schema problems?
Thanks all
Microsoft SQL Server Management Studio 9.00.2047.00
Microsoft Analysis Services Client Tools 2005.090.2047.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 6.0
Microsoft Internet Explorer 6.0.2900.2180
Microsoft .NET Framework 2.0.50727.42
Operating System 5.1.2600
View 2 Replies
View Related
Mar 17, 2007
I am working with SQL Server 2005, here is what I am doing:
declare @cx as varchar(100)
set @cx = substring(db_name(), dbo.instrrev('_', db_name()) + 1, datalength(db_name()) - dbo.instrrev('_', db_name()))
exec ('CREATE SYNONYM tblsynonym FOR ' + @cx + '..TableName')
---Procedure
drop synonym tblsynonym
The application i'm working on uses stored procedures that will at some point be called by more than one user at a time. At the start of the stored procedure the synonym is created and then it is dropped when the procedure completes, the issue is this: if two users access the same stored procedure at the same time then the first procedure will create the synonym and the second will fail because the syonym already exists.
Here is what I would like to do:
declare @cx as varchar(100)
declare @timestamp as datetime
set @cx = substring(db_name(), dbo.instrrev('_', db_name()) + 1, datalength(db_name()) - dbo.instrrev('_', db_name()))
exec ('CREATE SYNONYM tblsynonym' + @timestamp + ' FOR ' + @cx + '..TableName')
---Procedure
drop synonym tblsynonym
Any ideas??????
View 7 Replies
View Related
Jan 25, 2006
I'd like to use a data flow task to load data into a table by specifying the synonym name of the destination table, instead of the actual table name.
The OLE DB Destination is forcing me to pick an actual table or view from a drop down list. Any ideas on how to get around this?
Thank you.
View 4 Replies
View Related
Jun 17, 2014
I need to get the object type (view, table ...etc) for a synonym base object inside a script. The only place where I see something related to this stored is in column "base_object_name" in sys.synonyms but there I can see only the same with format [database].[user/schema].[name]. After some testing playing with different users without specifying database/schema I think that maybe the object_id must be stored in a another place, my first idea was parent_object_id in sys.synonyms but it isn't stored there.
know if object_id for the base object is stored in any other place ?
View 6 Replies
View Related
May 13, 2002
I am new at this and we encountered a problem. Can names in the public role be deleted? We have some names that need to go - however the delete option does not high light?
I would appreciate your help..
View 8 Replies
View Related
May 14, 2008
Hi Guys,
I am unable to deny DMV rights to public. I have already ran the SQL query successfully:
"DENY VIEW SERVER STATE TO public" and "DENY VIEW DATABASE STATE TO public"
However when I check my master DB, the public still have rights to all the dm_***** objects. Am I doing it wrong or is there any steps I missed out? Can anyone help please?
Thanks a million.
View 1 Replies
View Related
May 7, 2008
Is there a way to make a report public, to outside your domain users? We have a web application the users are authenticated in that is not in .NET and not using NT authentication and we want to have a report linked from inside the application that will pass the parameters in the URL. This is not very sensitive data and the report is using SQL authentication. We also don't want then to log in a second time for the report.
Can this be done easily?
Thanks
Linda
View 6 Replies
View Related
Feb 23, 2007
Hi,
I'm actually using global public variables in the custom code of my reports.
Is there a "chance" that , if the report is executed at the same time by two users, values calculated for an user will be crushed by other user's execution ?
Thanks in advance.
Grégory.
View 4 Replies
View Related
Mar 28, 2007
Are there any restrictions, limitations or anything to prevent the use of SQL Express database being used with my ASP.NET 2.0 application on a public web host?
If so, what are they?
Thanks.
View 10 Replies
View Related
Mar 16, 2004
While connecting to the DB through a public IP from my system i'm getting an SQL Server does not exist or access denied.But while using localhost its working fine.DB setting in the web.config file.The Code is
<!-- application specific settings -->
<appSettings>
<!-- <add key="connString" value="data source=10.1.1.228;initial catalog=ACE;password=XXXX;persist security info=True;user id=sa;packet size=4096" />-->
<add key="connString" value="packet size=4096;user id=sa;data source=EBIZ;persist security info=True;initial catalog=ACE;password=password" />
</appSettings>
What to do for this error.
View 1 Replies
View Related
Apr 26, 2001
Can I grant rights to "public" role ( customize it). Our app uses it.
thanks,
View 1 Replies
View Related
Apr 4, 2000
Is anyone using SQL server to navigate their public web site?
We are concerned about having a database hit every time the user chooses a different page from our navigation bar.
Any advice? Experience with this?
View 2 Replies
View Related
May 2, 2007
I have a db that I use as the backend to an Access application. The application looks at 2 databases that are on the clinet machine. A db from a vendor and my new database. I can read the vendor db (with the proper dns), but I can only read my db when the user has admin privileges. I have granted the public all permissions for the table on my db. What am I missing?
Also, this is a db on a Small business Server 2003 so all of the SQL tools do not appear to be there.
TIA
View 2 Replies
View Related
Feb 14, 2008
set up windows 2003 server
sql server 2000
have public IP from netword soluctions
I can see website
what settings to i need to open up sql server to the public?
View 12 Replies
View Related
Mar 1, 2008
Hi,
I have installed a MS CRM 3.0 Server with SQL 2005 Reporting Server on the same server.
Whenever I access reports from MS CRM with internal IP i.e http://192.168.100.55:5555 within my network every default as well custom reports are working fine.
But the same when I access with Public IP i.e. http://209.199.X.X:5555 I am able to see the application in public i.p but the reports are not working.
Is there any way so that I can access my all reports from MS CRM in public IP.
Thanks
Kshitij
View 1 Replies
View Related
May 30, 2007
I am trying to use variables that are declared in a report that I am created in SSRS 2005.
For example:
Declare @Month as int
Set @Month = case when month(getdate()) = 1 then 9 else month(getdate()) - 3
When I do this, I get an error message, 'The declare cursor SQL construct or statement is not supported.'
So how do i properly declare a variable that can be used through all my dataset?
Thanks, Iris
View 10 Replies
View Related
Jan 3, 2007
Hi
I have a question, the public user, what rights does hen need on Master and MSDN we runn a Application Vulnerability Assessment and it became obvius that he has quite a few rights like adding jobs.
Any sugestions?
View 4 Replies
View Related
Oct 3, 2006
In a SQL 2k instance (latest SP) some of my user databases show the public role with execute on a variety of stored procs named dt_* (i.e. dt_addtosourcecontrol). However, not all the user databases do this, some do not grant the public role execute on these procs .
So, can someone explain what generates these permissions and is it acceptable to remove them? If I have a database that does not grant public access, should I be concerned? I don't see any reference to these procs in BOL.
TIA,
Moblex
View 1 Replies
View Related
Aug 24, 2007
Is it possible to script the Public role? Delete authorities granted to Public?
I need to copy all the permissions of the Public role from one database to many others. The databases were setup incorrectly with many authorities granted to Public.
View 1 Replies
View Related
Aug 2, 2006
Hi Ppl,
I have installed my program and SQL server 2K5 on the server.
But when I try to run it (from he client machine)I get the following error :
It works fine on the SERVER
The appication attempted to perform an operation not allowed by the security policy.
The operation required the security Exception. To grant this application the required permission
please contact your systems Administrator or use the Microsoft .NET security policy administration tool.
If you click Bla,bla,bla
Request for the permision of type System.Data.SqlClient.SqlClient
Permission, System.Data Version - 1.0.5000.0. Cultre = neutral.
Public key Token = b77a5c561934e089
View 3 Replies
View Related
Mar 30, 2006
In exploring permissions that users have, I find that they all have VIEW ANY DATABASE permission which they inherit from the public server role. You can see this by selecting the Permissions page on the Server Properties dialog and highlighting "public". The permission shows as having been granted by sa. This is listed as a server role. However, it does not show in the list of server roles and I can't find any documentation for it (RTM BOL). Interestingly, if I revoke this permission (which is the only permission this role has), the public server role disappears from view. But I can subsequently regrant the permission with Transact-SQL in master and the role comes back.
I would like more information about this role. It seems to be sort of "secret".
When I revoke the permission, users can't see any databases except master and tempdb (both of which have active guest users) even though they have been granted access to other databases.
What I was trying to accomplish by changing this permission was to allow a user to see only those databases which they are allowed to use. But that does not seem to be possible.
Thanks for the help.
Sharon
View 5 Replies
View Related
May 24, 2000
Hello all,
I'm having trouble copying my production database to a development version because I have a login user in the public role that is not a valid user. I can't find any reference to the login/user anywhere in my database or in NT security, on my server for that matter.
When I open the public role through Enterprise Manager, I can see the logins/users in the list, but the 'Remove' button is disabled. I also tried to use the stored procedure 'sp_droprolemember', but it says that 'public' is not a role in the database.
DTS keeps blowing up on this object when exporting, and I need to get this stuff copied ASAP.
Thanks for all help
Kevin
View 1 Replies
View Related