Get XML schema from database schema (SQL Server 2008 diagram) - sql-server

Get XML schema from database schema (SQL Server 2008 diagram)
I am using SQL Server 2008. Is their is a way to do this in the SQL studio enterprise manager?
Rather than write code or use an external tool

SQL Server Management studio doesn't provide a way to do this.
Pasting the following into a code window gives you something close:
select * from INFORMATION_SCHEMA.COLUMNS for xml auto
Failing that, the answer is no, not without writing code or using an external tool.

Related

How to Transfer/Migrate data from SQL Server 2008 to ORACLE 11g?

Hello guys I have Tables , Views , Stored Procedure in my sql server and now I want to transfer it in Oracle but I don't how to do it. Is there any tools that I can use?. Thanks.
Yes. We (Oracle Corp) give you Oracle SQL Developer which includes a full database migration kit, including T-SQL translators which will move your code into Oracle PL/SQL.

Can not modify stored procedure on Azure

I'm new to Azure SQL database.
I managed to migrate my database to the cloud.
Now I'm trying to modify a stored procedure using Microsoft SQL Server Management Studio (the latest edition - 2014). But get the following error message:
USE statement is not supported to switch between databases. Use a new
connection to connect to a different database.
Any idea how can I do this?
Also, is there any alternatives to Microsoft SQL Server Management Studio to work with Azure SQL Database?
USE in sql is used to switch between databases not to modify stored procedures. You cannot use USE on Azure SQL as per the specification. You should be able to right-click on the database name in Microsoft SQL Server Management Studio (SSMS) and select New Query, or you can use the dropdown list in the menu to switch databases. You can then use ALTER PROCEDURE (https://msdn.microsoft.com/en-GB/library/ms189762.aspx) to alter your procedure.
You can use Visual Studio as an alternative to SSMS but IMHO Visual Studio is not as productive. It doesnt matter which client you use though, because USE wont work in any of them.

Proper way to Import data from Access to SQL Server?

I'm asking for the proper way, in SQL Server's T-SQL (I think that's what it is) code or using another language, to import data from a Microsoft Access MDB Database into a new SQL Server Database.
Now, typically I would just import it in. The problem is I'm writing a .SQL script (I could use another technology if needed) to do all this leg work as this will need to be done fairly regularly. Likely at least once a week, for about 5 months in the year.
To digress a tad, I had wanted to implement a single database and distinguish separate source database using something like a DatabaseID field, but the powers that be overthrew me there.
I was previously using SQL Server Management Studio 2012 with SQL Server 2008 running the T-SQL (on a production machine) that worked fine. I've now migrated to a local SQL Server Management Studio 2012 with SQL Server 2012 (for development) and the code that used to work doesn't anymore.
This code is what used to work: SELECT * INTO [dbo].[Controls] FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0', 'Data Source=C:\Show.mdb; Jet OLEDB:Database Password=BobSaget')...[Control] The password has been obfuscated for security ...
That's likely a sloppy solution. What's the ideal way?
Thanks in advance!
I would recommend using Microsoft's SQL Server Migration Assistant for Access.
SQL Server Migration Assistant (SSMA) is a free supported tool from Microsoft that simplifies database migration process from Access to SQL Server. SSMA for Access automates conversion of Microsoft Access database objects to SQL Server database objects, loads the objects into SQL Server, and then migrates data from Microsoft Access to SQL Server.
SSMA for Access v5.2 is designed to support migration from Microsoft Access 97 and higher to all editions of SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL Azure.
You can find it here.
You may need to fix the structure after the migration as it tends to over exaggerate many of the data types.
Have you checked your DCOM security on MSDAINITIALIZE?
I had this problem when moving to a local instance of SSMS 2012.
http://blogs.msdn.com/b/dataaccesstechnologies/archive/2011/09/28/troubleshooting-cannot-create-an-instance-of-ole-db-provider.aspx

Problem with importing an mdf created with SQL Server Express 2008 into SQL Server 2005

The question is probably extremely easy to resolve, but I need to resolve it because I need to carry on with my project. I am using SQL Server Express 2008 at home, and I've been working on an ASP.NET MVC app that stores my DB in an mdf file in the project's folder. The problem is that the SQL Server in the Uni labs is SQL Server 2005, and when I try to open the mdf file with the VS Server Explorer,It says that the version of the mdf file is more than the server can accept.
The only option that comes to my mind is exporting the DB as an sql file, just like I've done it thousand times with phpmyadmin. the thing is that the SQL Management Studio Express is not the most usable tool in the world, and for some strange reason all the articles I could find in Google were irrelevant. Please, help.
It is not possible to attach database created on SQL Server 2008 to SQL Server 2005. The other direction is possible.
Your only option is to script the database and data and run the scripts on SQL 2005. If you have used any of new features of the SQL Server 2008, you will have to rewrite the scripts.
I haven't used it much, but right click on database -> Tasks... -> Generate Scripts... / Export Data... / Import Data... should do the job right.
Google "Database Publishing Wizard", it's a tool from Microsoft to script an entire database, both schema and data.
you can script your db and its data. then run it on the target server to create a new db that is compatible with 2005 version.
Tools like Red-Gate SQL Compare and SQL Data Compare can compare a live database to e.g. a backup file, so you could compare your SQL Server 2005 database against the SQL Server 2008 Express backup file, and move data that way.
Or you could possibly generate INSERT statements for your tables that have changed data using a tool like this one here or this one here. These can generate INSERT scripts for your tables, which you can take along and run on your SQL Server 2005 target system.

extract schema for sql server compact edition

Is there a way to generate the sql statement for tables in sql server compact ?
same as for sql server express+ ?
Essentially a create table( .... ) statement as output ?
There is a project on Codeplex that someone has actually built the functionality to be able to do scripting for sql server compact edition databases.
There is a tool to do this. Check out http://www.antipodeansoftware.com/Home/Products
This will iterate the entire SQL server, and write all the table, view, stored procedure and UDF scripts to a local drive. Great for adding SQL schema or DDL to source control.
The plugin SQLite & SQL Server Compact Toolbox has versions for Visual Studio and SQL Server Management Studio. I've used the latter version successfully to add columns and export the schema as CREATE TABLE statements from SQL Server Compact Edition 3.5.
You can connect to SQL Server Compact Edition using SQL Server Management Studio(SSMS), which in turn allows you to script out all database objects.
Please refer to: Managing SQL Server Compact Edition with SQL Server Management Studio
and then also, How to: Generate a Script

Resources