SQL Server synonym that appoint to Database - sql-server

I have reviewed documentation and have only seen the possibility of creating synonyms to database objects and aliases for an instance of SQL Server but not a method to create an alias / synonym to a database.
Has anyone found themselves in the same situation and how did they solve it?
Thanks

There is no way for a database alias like for objects with Microsoft SQL Server.
However you can create a linked server to a database even on the same server. This is the closest to get to an alias.
This is actually a pretty nice way to keep code stable while being able to move databases between servers later to scale out.

Related

Remote Link between PostgreSQL and Oracle database

how to create a synonym for a table of a schema in postgresql database on a server into a schema of oracle database on another server?
I have a schema on oracle database on a server and want to create a synonym a table present in a schema of postgresql database on another server.
To create the synonym, we need to have database remote link between these two databases present on two different servers.
How can we do this? Please provide me one solution.
Just to clarify, I believe the question is trying to figure out how to get PostgreSQL data to appear as a table inside of Oracle. (The existing comments seem to be reading it the other way around, in which case, yes, an FDW would be the solution, but in this case that will not work).
In the past (on older versions of Oracle) when we needed this we were forced to build custom replication scripts to transfer data from Postgres into Oracle systems. For a single table, it is pretty straightforward to do with something like Perl & DBI... feel free to substitute that with your favorite scripting language.
On newer Oracle systems, I believe you can use Oracle Database Gateway to accomplish this. I am not sure if they support Postgres directly, but they do support ODBC (and I think JDBC) which should work. Here is an example blog post setting this up with MSSQL (http://oracle-help.com/oracle-database/installation-oracle-database-gateway/), the process should be similar for Postgres.
Hope this helps!

How do I convert Microsoft Access file into SQL Server database?

I want to know how to convert an Access database file into a SQL Server (.mdf file) database?
The MS Access "Upsize Wizard" was discontinued with Access 2012. SQL Server Migration Assistant (SSMA) is now recommended. Reference: https://accessexperts.com/blog/2013/01/30/access-2013-is-here-but-wheres-the-sql-server-upsizing-wizard/
However, as Johnny Bones noted, I found it relatively easy to create a new empty SQL Server (2012) database and then import:
SQL Server Management Studio, R-click on the newly created Database | Tasks | Import Data -> SQL Server Import Wizard
I used "Access Database Engine" instead of "Jet Database Engine" for
no reason other than I GUESSED Jet was older. Mine is a throw-away
project you may want to research the difference.
I 'weeded out' the
Access queries (views) and just imported the tables.
So far it looks
like everything was imported OK.
The simple answer is; you can not "convert" an Access database to a SQL database. You can, however, import the Access database (tables only) into SQL. Remember that SQL is a true database, and, as such, contains no front end or GUI creation mechanisms. You will still need Access (or C# or VB or another front-end builder) to create the interface.
You may already know this, but in SQL Server a Query is called a View, and Modules are called Stored Procedures. You will need to convert your Access queries and modules accordingly if you're planning on having that all reside server-side.
It's actually pretty easy to import Access tables into SQL Server, you would just create a database on a server, right-click on the database name and choose Tasks --> Import Data. There you will choose Microsoft Access as your Data Source. The rest should be pretty self-explanatory.
JonnyBones wrote a good full answer. Other have made suggestions for tools which may work. However, the SSMA (SQL Server Migration Assistant) is likely to be the best option now. (See this youtube video for help with understanding some of the issues to overcome and an explaination of how to use SSMA.
Befre you consider using other tools, which may do more, you should find out why to use them instead of SSMA. Check out the youtube video as a starting point.
Be aware that the MS Access Upsizing wizard was great but is now discontinued, and there was a bit of a gap before MS created a decent version of SSMA, which is when&why these other tools came into existence.
SSMA should do what you need.
There are some access things that do not get moved to SQLServer and some that do.
eg Access triggers do not. Access tables constraints do, Access boolean datatypes so - of sorts - but you need to do some work. The video will explain most issues well.
Harvey
You can try with the Upsize Wizard or copy content of the table from SHOW TABLE DATA and paste to the target table with the same structure as the source.

Transfer SQL Data between two databses

I am using two similar SQL database in two different servers one is local and another one is online. I want to transfer data at the end of the day from the local server to the online server.
what is the best method to automatically transfer data and protecting primary keys effectively.
Thank you
Use Red-Gate Data Compare. It's commercial, though.
(I'm just a satisfied customer and in no way related to Red-gate)
Open SQL Server Management Studio and connect to both servers, in the Object Explorer right-click on a server and choose Tasks, and select Import Data or Export Data, then it's a simple wizard to go from there.
SSMS can also do a schema compare (no need to pay for RedGate Comparison software) if needed.
Have you considered using Replication?
replication tutorial
I believe what you are trying to do is a Mirror database, updated daily, if that is the case:
Using Database Mirroring is a best practice (Instead of manually doing this yourself), I suggest:
Read about Mirroring here: Database Mirroring
Follow this guide: Setting Up Database Mirroring
Your local server should be the principal and your online will be the mirror
I highly recommend this approach , instead of manually scripting the data (see link to answer below), it will give you benefits such as automatic failover (when your local server crashes it will use the remote one) , you can read all about the benefits in the links above.
If you eventually want to do it manually for any reason, or you don't have the SQL Server Enterprise edition , then read my answer to this question:
sql-server-copying-tables-from-one-database-to-another

Full-text catalog - what is ftCatalog in SQL Server?

Using select * from sys.fulltext_catalogs against my SQL Server 2008 database, I can see a full-text catalog.
I would like to know:
What is ftCatalog? Is a default value?
Could I remove it safely? How to do it?
Thanks for your help
I'm no FTS expert, but I have never seen a default full-text catalog created by SQL Server and the documentation doesn't mention it. By observation, none of my SQL Server 2008 databases have anything in sys.fulltext_catalogs.
However, the example in the documentation I linked to uses "ftCatalog" as the example catalog name, so to take a wild guess, someone else with access to the database created the catalog by copying the example in the documentation.
Whether or not it's safe to drop depends on who created it and why. If it's a development server and you're the only developer working on the database then the risk of dropping it is limited. But if this is a production database then I wouldn't, unless you can definitely verify why the catalog is there. sys.fulltext_indexes might be a good place to start your research.

Doctrine2 SQL Server Mapping Generation

I have a large (100+ tables) SQL Server 2005 database that I would like to start mapping with Doctrine. Right now I've done a manual job of a few tables (no relations yet, just disparate tables), using PHPDOC annotation mapping inside my entities. Manually it works like a charm ... however it really will take ages to get everything mapped out and I'm looking for an easier way.
I looked into ORM Designer, but it doesn't seem to offer imports from a SQL Server database. I also looked at using Doctrine CLI and doing the "reverse engineering" mentioned here. Finally tried using orm:convert-mapping --from-database with no luck. It appears the last two are conditional on the fact that the sqlsrv drivers (running on IIS7 here) cause an error on my tables when they have no index: PDOException: The active result for the query contains no fields.
Is it possible that I can load up Doctrine on an Ubuntu machine, and use whatever drivers Linux has to connect to SQL Server 2005 ... then perhaps the orm:convert-mapping feature wouldn't die on me?
Any help would be much appreciated!
Try with this drivers for php. (clue: non thread safe)
Also check your connection parameters.
I worked on a SQLServer 2005 express project with Symfony2 and I mapped all my tables in reverse with no trouble at all.
Well, actually had to implement a new doctrine type for datetime as it says here.
Good luck!

Resources