API For Synonyms

Mar 28, 2007



Hi Experts:

I am writing a general API which would fetch synonyms from any database
providers (and would filter for a given schema).

I am using GetSchema method on DBConnection object and it works fine for
oracle.

SQL Server 2005 has a support for synonyms, but the above piece of code does
not work. Is there any API by which i can get the list?.

Thanks

AK

View 1 Replies


ADVERTISEMENT

Using SYNONYMs

Apr 21, 2006

From what I'm seeing in MS documentation I would like to use SYNONYM to obtain information from a remote servers tables.  I've tried to find some decient documentation on using it, but can't see to find a clear example for remote servers and in my testing I can make the SYNONYM but the conneciton is failing.
Any helpful hints or references would be welcomed.
Thanks,Ken..

View 8 Replies View Related

Synonyms

Nov 20, 2006

Hi all,

Just as a curiosity (and thoroughness) thing, why are there synonyms in SQL Server? When I say synonyms, i mean INT and INTEGER, OUT and OUTPUT: These word pairs mean the same thing!

And in some examples they chop and change between the use of these words... It adds to the confusion.

Anyhows I'm curious as to the "why" behind this.

Thanks

Chris

View 3 Replies View Related

Synonyms Database

Nov 26, 2004

Hello ,

Where can I download synonyms database ?

Thank you !

View 5 Replies View Related

Recovery :: Using Synonyms On AG

Oct 28, 2015

I currently have a 2 node Availability Group that houses some big warehouse type of DB’s. It’s not uncommon to see DB1 populate DB2:

Use db1
Go
Insert into db2.dbo.table_1 values ‘ssfsfsfsf’

This all works as expected. However, we want to split these DB’s away from each other to reduce CPU impact on any one instance. Of course though we don’t want to have to go and change all the connection strings in our SSIS Packages.  By default this would now require going to a 4 part naming convention like so: Insert into newServerName.db2.dbo.table_1 values ‘ssfsfsfsf’Again though, we are trying to avoid this. That said I was thinking to use synonyms. This works as expected, until a failover occurs, and the synonym is redirected to the local Read Only version of DB2.So in other words, SQL Server is behaving exactly as it should, but I need a way to work around it.

Example below:

USE [master]
GO
/****** Object:  LinkedServer [DB2]    Script Date: 10/28/2015 11:43:46 AM ******/
--note this is pointed to the AG Listener name, for failover purposes.
EXEC
master.dbo.sp_addlinkedserver
@server = N'DB2', @srvproduct=N'sqlserver', @provider=N'SQLNCLI',
@datasrc=N'myAGListenerName', @catalog=N'DB2'

[code]....

Again, SQL Server is behaving exactly as it should. However, this synonym is now fairly worthless, as it can't handle failing from one node to the other in the AG

View 2 Replies View Related

Getting JDBC Metadata For Synonyms

Sep 18, 2007

Using the Latest JDBC Driver from SQLExpress I'm attempting to get use the getTable() method to get information about database objects that the user can access/alter. Works fine for for tables and views, but can't seem to get any information returned for synonyms.

Is it possible to get information for synonyms, e.g. column definitions? or am I'm missing some setting in the connection.

Any Help would be appreciated!

Dave.

View 5 Replies View Related

Is There A SQL Server Equivalent For Oracle Synonyms?

Jul 9, 2004

I have a SQL Server database which has one user (UserA) which owns some tables. I've added an additional user (UserB) to the database such that it has access to the tables owned by UserA. What is happening is that when I log on as UserB I have to fully qualify table names and fields in my SQL statements when I deal with tables owned by UserA. Is there a way make the tables accessible without specifying the owner? In Oracle you could create a public synonym for the table eg. <table_name>. Wherever that synonym is referenced the DBMS would know thats its refering to UserA.<table_name>. Is such functionality available in SQL Server? Thanks.

View 2 Replies View Related

Severe Error Encountered With Synonyms

Oct 10, 2006

we now used synonyms on the version 6 of our peoject, at first it turns out good. Then we migrate a database to the new database, everythings fine, its just a data migration anyway. The target database' structure and DML's wasn't change during migration. then intermittendly, we're encountering "A severe error occurred on the current command. The results, if any, should be discarded". I said its intermittent because sometime its ok, mostly its not functioning.

This is very painfull because all our scripts has this synonym. All our scripts uses an sp execution logging stored procedured of another database so we created a synonym for those sp's instead of fully qualifying the procedure name.

This is a major issue for us, please advise. You may response here, send me email or email me. Many Thanks.

Rodel E. Dagumampan
Email: dehranph@gmail.com
Yahoo: dehranph
Blog: http://community.devpinoy.org/blogs/dehranph

View 7 Replies View Related

Can Synonyms Be Used To Replace Hundreds Of Lines?

Sep 10, 2006

Hello

I'm looking for a way to store a large chunck of text (200 lines) in a variable which can be called in different objects within the database.

For example: I have several stored procedures that create the same temp table which exists of 200 column names over and over again.

It would have to look like this

Import myScript (I keep thinking of Import like used in .NET)

and myScript could exist of:

CREATE #MyTable(
...)

or even some simple text or a part of a sql statement.

I'm familiar with synonyms but you can't use that in this scenario.
Then I thought of functions. The scalar function returns a result, not what I want here. Table valued function return tables, not what I want.

Many thanks in advance!

View 3 Replies View Related

Synonyms Containing Tables From Another Database And Permissions

Jul 17, 2007

When you create a stored procedure and give the user execute permission, you don't need to give the user select permission on the table used in the stored procedure.



If one of the tables in the stored procedure is a synonym referencing a table in another database, and the user is already in the other database, you get a select permission denied on that table and I could only get it to work if I gave the user select permission on that table.



Is there a way around that, since I hate giving select permissions on tables?




Thank you,
Wissam

View 3 Replies View Related

Problems With Synonyms As Data Sources

Apr 14, 2008



I am using a sql 2005 database that contains a combination of local objects plus synonyms for objects from a second database. I have had no problems using synoyms for tables and views in reporting services but can't get synonyms for stored procedures to work as a report data source. All databases are on the same server and we have installed service pack 2.

Any suggestions?

View 2 Replies View Related

Implementation Of A Backend/frontend Architecture Using SYNONYMS

Mar 28, 2008

Hi!
I am evaluating an architecture for one of our project... a SQL database containing the data (backend) and a second database containing the development code (frontend) linked to the backend with synonyms.

It enables to upgrade the code without touching the data. Or to change the backend / use a different set of data at will.

Everything was going fine, the behavior was expected to be EXACTLY the same with synonyms as with real tables. But I came accross a problem:
Let's say we have a synonym (frontend) dbo.TABLE1 that points to a table (backend) with a IDENTITY column.

I have a sp (frontend) with the following code:
INSERT INTO dbo.TABLE1...
SELECT @SCOPE_IDENTITY = SCOPE_IDENTITY()

Well in that case, @SCOPE_IDENTITY is NULL!

Anyone has ever faced that problem? Should I use another function to return the last ID inserted? Or is it the backend/frontend architecture that is completely flawed? I also heard there's a way, by creating the tables and the code on different filegroups, to restore only the tables or the code...

Thanks for your input!
Frantz


View 13 Replies View Related

SQLCMD Error - Working With Variables And Synonyms

Jan 3, 2008

Hi All,

Been doing some testing with SQLCMD and variables for installation scripts, enclosed below is some source code.
The one problem, I've been getting is the following error:

Incorrect syntax near 'certification'

This has been tested only in SSMS utilising the run in SQLCMD mode.

This error only occurs on the SQLCMD variable replacement, where it replaces $(Cert_Schema) for the word Certification.
Running the CREATE Synonym with the word Certification hard-coded into the script works.

Any ideas?
Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

Best Regards,

D


USE [Testing]

GO

/****** Object: Table [certification].[Table_1] Script Date: 01/03/2008 11:22:48 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [certification].[Table_1](

[PKId] [smallint] NOT NULL,

[Name] [nchar](10) NULL,

CONSTRAINT [PK_Table_1] PRIMARY KEY CLUSTERED

(

[PKId] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

--- SQLCMD Script below:
-- line below should read, colon setvar cert_schema 'certification'

etvar Cert_Schema 'certification'
-- The line below fails to work for some reason

CREATE SYNONYM crt_asa FOR $(Cert_Schema).Table_1

DROP SYNONYM crt_asa

-- Hard-coded equivilant line works

CREATE SYNONYM crt_asa FOR certification.Table_1

DROP SYNONYM crt_asa

View 3 Replies View Related

Starting Out With : Views, Stored Procedures, Functions, Synonyms

Mar 22, 2006

Hi,Right, i have a fairly good understanding of SQL. However, i have a fairly basic understanding of SQL Server.I know Storedprocedures are really good and i'm starting to use them. I understand they are good for making inserting, updating very easy.However when you look at a SQL Server database you get various folder, this leaves me a little confused with what they are all used for? whats the difference between these?Thanks in advance!sorry for the basic question, i'll try to challange you next time

View 1 Replies View Related

SQL Server 2014 :: Script To Search For A String In All DB Objects (Including Synonyms)

Jun 29, 2015

I'm looking for a "God-script" to search for a given string (case invariant) in all DB objects (esp synonyms) in all DBs on a server?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved