Import Data Between Servers with Different Version - sql

I need to transfer data from sql 2012 to 2000 so I decide to create a file of insert using "Generate Script" in sql 2012 then Execute it in sql 2000.
But one of the columns DataType is Date; The Sql 2012 generates Date like this:
CAST(0x13FC0A00 AS DateTime)
But SQL 2000 throw Syntax error when executing the above code
Syntax error converting datetime from binary/varbinary string.
How can I fix this error?

Try in SQL Management Studio going
Tools -> Options -> SQL Server Object Explorer -> Scripting
Set "Script for server version" to "SQL Server 2000".
Then re-generate the scripts.

Related

Export from select Statement to JSON in SQL

I use Microsoft SQL Server Management Studio v17.2. I know that for exporting data to JSON must use method like this:
SELECT *
FROM table1
WHERE [conditions]
FOR JSON PATH, ROOT('root')
but when I use this code in SQL Server Management Studio, an error occurred:
Incorrect syntax near 'json'.
Please help me solve this error.
This doesn't have anything to do with Management Studio; the version of SSMS you're using is irrelevant. It has to do with the version of SQL Server you're running the code against, which is completely separate from the version of SSMS.
FOR JSON was introduced in SQL Server 2016. If you are not running 2016 or better (or Azure SQL Database), you'll need to upgrade, or use a different approach to get your data into JSON format.

Generate an "INSERT INTO" script from SQL Server to Postgres

I need to generate a script with the data from one db in sql server to postgres. It seems the "Generate Script" in SQL Management doesn't do ANSI format like INSERT INTO that I need.
How can I do it?
I suggest.
Fire up an instance of Postgres on an accessible device.
Set up a linked server from Microsoft SQL Server to access the postgresql server using the postgres 64 bit odbc driver.
Start writing TSQL to transfer the data.
https://www.google.com.au/search?q=postgresql+odbc+sql+server+2012

IF NOT EXIST option is not coming in SQL server 2012 while generating script file

Not getting "IF Not EXIST" option is not getting in sql server while generating script file. This option was present in sql server 2008 but not showing in 2012
While generating script file in SQL Server 2012 we can’t see the “IF NOT EXIST’ option , which was present in SQL Server 2008 to check the existence of the object. This feature is also present in 2012 but we have make true the option “Check for object existence” to get the same output as SQL Server 2008.

How to check SQL Server 2008 script will work properly on SQL Server 2005

Is there a way (a tool) to check that a SQL Server 2008 script will run on SQL Server 2005?
Open up SQL Management studio, rt mouse click on the database name, select properties, select option, set compatability level. Test. A far as is known, when the compatabailty level is set to a (lower) level, functionality is disabled and errors raised entirely in line with the selected level. MS are a bit relctant to comit http://msdn.microsoft.com/en-gb/library/bb510680.aspx but in practice I've not found any issues. You can of course install an instance of the 2005 build and bulk insert for a really thorough check.
You can use SQL Fiddle for SQL Server 2008
At the left top you can select the RDMS

Unable to Import a database from Microsoft SQL Server Management Studio to phpmyadmin

Hey folks, the person I am buildling a website for decided to design their own database. They used Microsoft SQL Server Management Studio to build it and such. Now that they are done with the database they exported it to a text file (Tasks -> Generate Scripts). Now when I try to import the file into phpmyadmin I get the following error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[master] GO /****** Object: Database [Butterbakers] Script Date: 02/15/201' at line 1
The database code is here: http://zamn.pastebin.com/Y3u7MpZ9
phpmyadmin is for MySQL.
Microsoft SQL Server is a different DBMS.
Large parts of the SQL Syntax is DBMS/vendor specific.
The MySQL Workbench has a feature to "Create EER Model from existing Database".
This may be a try but you need a jdbc connection to the MS SQL Server and MySQL...
Converting DDL to a different DBMS is all but easy. And if you're done this doesn't guarantee that an probably already existing application is still working with the other DBMS.
Not switching DBMS and using the free MS SQL Express could be an option.
First decide for a DBMS and restart form zero is surely the cleanest and less painful solution.
With SQL Compare (http://www.red-gate.com/products/sql-development/sql-compare/) and SQL Data Compare (http://www.red-gate.com/products/sql-development/sql-data-compare/) , you can synchronize different DB.