How to create table in SQL Server 2012 using script file generated from SQL Server 2005? - sql

How to use a script file generated from SQL Server 2005 and create the same table in SQL Server 2012?
Plus I have a script file for each table, how could I combine them all to generate my database?

Just create a database on SQL Server 2012 and run each create object script.
If some error or warning arises you can work it by demand.
note the tables got dependencies, so it's a good idea to create that tables in the right order.
You also can create the tables and put a no check in the FKs creation snipets and switch all FKs to check once all tables ar in place.
Also it's good to create all tables before creating the views, etc.

Related

SQL Server Compact Edition - Obtain create script

I normally live in a MySQL world where I can use the
SHOW CREATE TABLE <tablename>
syntax to get the create script of a given table.
I'm working with a legacy SQL Server CE 3.5 database and need to get the create script for all of the tables so I can move them into another database which will be created by my application.
Is there any equivalent to the MySQL functionality that would allow me to do this?
YOu can use my free tool to to script object creation and data statements from a SQL Compact database - http://sqlcetoolbox.codeplex.com

Update from linked server (mysql) to local sql database.

I am looking for a way to setup a scheduled update from a linked server I created to a local db, I am not familiar with triggers but from what I've read you have to set them up on the originating server, and I only have read access to the mysql Database. Basically all that I am trying to do is make a local copy of two tables from the mysql db. I can manually do so with select into statements, but I would like to have some automation if possible. Any thoughts on how to achieve this? Also I am using SQL server 2008 R2. Thanks!
You have several options to do:
Copy all data from the source table (do not use this if the source table is big)
If you have a column in the source table which can be used to determine which records should be copied, use that (this is mostly an auto updated timestamp column in MySQL)
Set up a trigger to track modifications
To copy, you can set up a Linked Server or you can use SSIS
To use a linked server you can use OPENQUERY()
You can schedule your task with SQL Server Agent

SSIS import all Paradox tables into SQL Server 2012

Writing my first SSIS package in VS 2012 and have managed to get it to connect to he Paradox tables without any problems.
What I need to do is go though each table and import the data into a corresponding table on a SQL Server database. There is no transformation of the data, as the table structures are the same. All that needs to be done is the data in the SQL Server database must first be deleted and then the data from the Paradox tables inserted.
I can connect one table in Paradox to one table in SQL Server but I want to do them all, please tell me I don't need a separate data task for each
Thanks
Ken
Try using a ForEach Loop Container to enumerate all the tables in your database.

create sql server database as other sql database structure (design)

I need to create sql database just like other sql database (without the data) via sql script
some one told me that Oracle has this ability by some code like
create database <your new DB name> as <the old DB name>
so is there a similar statement or workaround in SQL
I use MS-SQL Server 2008/2008R2
I don't want the 'generate scrip' solution as this provide a very long script, I just need the Oracle statement (mentioned above) but in SQL
to be more clear I need the tables structure only (no data) and need all other objects such as functions, views etc...
Please advice,
In SQL Server, you can right click on the database then select "Tasks" then "Generate Scripts" and you can build one script for all your object sans data.
If you are asking about SQL Server (at least in 2005 or newer, not sure about previous versions) if you right click on a Database in SQL Server Management Studio Go To Tasks and then Generate Scripts you have the option to Generate a script to create all the object ins the Database w/o Data.
Update:
You can also right click on a User Database and select Script Database as -> Create To just to get the TSQL to create the DB itself without any of the tables, stored procedure etc.

SQL Server 2008 cross server queries 2000

I need to create reports on SSRS 2008 from data available on SQL Server 2000, now; the database on SQL2000 is preferably not touched so I am avoiding adding stored procedures, views, indexes etc..
What would be the right solution?
What I would be needing is a place where I can put stored procedures, views etc so I can do reports.
Thanks.
create an ssis package / dataflowtask, copy your data from one source (sql 2000 - sql 2008r2)
create a reporting database, move your data to this database and make your reports on this database