Showing posts with label copied. Show all posts
Showing posts with label copied. Show all posts

Tuesday, March 27, 2012

Copying XML file into SQL

Hi, I have been having fun and games for well over a week now trying to get an xml file copied into an sql file, but still have no joy. I and using the bulk copy to do this and think I am close to solving it but just need a final push in the write direction.

In green below is the full source code, I think that the trouble is with the try statement part here:

Try

bulk.WriteToServer(xd)

This comes up with the error :

Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Data.IDataReader'

Basically how do I get the XML data into a reader (or IDataReader) format so that the writetoserver command can interpret it

I would be so greatful if someone could help resolve this it is becoming increasingly more frustrating

Protected Sub Button1_Click1(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Button1.ClickDim objXMLDim objXSL' destination tableDim connectionStringAs String = ConfigurationManager.ConnectionStrings("Database1ConnectionString").ConnectionStringDim myNewConnectionAs Data.SqlClient.SqlConnection =New Data.SqlClient.SqlConnection(connectionString) myNewConnection.Open()Dim productreaderAs XmlReaderDim bulkAs Data.SqlClient.SqlBulkCopy =New Data.SqlClient.SqlBulkCopy(myNewConnection) bulk.DestinationTableName ="Product"Dim productcountAs Integer = 0Dim settingsAs New System.Xml.XmlReaderSettings() settings.IgnoreWhitespace =True settings.IgnoreComments =True Dim xsAs String = (Server.MapPath("~/App_Data/XMLfile.xml")) Using readerAs XmlReader = XmlReader.Create(xs, settings)While (reader.Read())If (reader.NodeType = XmlNodeType.ElementAnd"product" = reader.LocalName)Then productcount += 1End If End While End Using Response.Write(String.Format("found {0} products!", productcount)) Using bulk bulk.DestinationTableName ="Product"Dim xdAs New System.Xml.XmlDocument() xd.Load("C:\Documents and Settings\Simon\My Documents\Visual Studio 2005\WebSites\WebSite1\App_Data\xmlfile.xml")Dim xrAs New System.Xml.XmlTextReader(Server.MapPath("~/App_Data/xmlfile.xml")) bulk.ColumnMappings.Add("TDProductId","TDProductId")' map First to first_name bulk.ColumnMappings.Add("name","name")' map Last to last_name bulk.ColumnMappings.Add("description","description")' map Date to first_sale bulk.ColumnMappings.Add("imageUrl","imageUrl")' map Amount to sale_amount bulk.ColumnMappings.Add("productUrl","productUrl")' map UserID from Session to user_id bulk.ColumnMappings.Add("price","price") bulk.ColumnMappings.Add("currency","currency") bulk.DestinationTableName ="Affilaite_Product_new"Try bulk.WriteToServer(xd)Catch exAs Exception Response.Write(ex.Message)Finally myNewConnection.Close() bulk.Close() xd =Nothing End Try End UsingEnd Sub

That's because bulk.WriteToServer method will not accept an XmlDocument as parameter. Why not use a DataSet in this case? So you can use such code:

Dim xs As String = (Server.MapPath("~/App_Data/XMLfile.xml"))
Dim ds As New DataSet
ds.ReadXml(xs, XmlReadMode.Auto)
--...add your code
bulk.ColumnMappings.Add("TDProductId", "TDProductId")
--...
bulk.WriteToServer(ds.Tables(0))

BTW, if you're using SQL2005, you can load XML files (actually all BLOB data, including images) into SQL database by using simply OPENROWSET with SINGLE_BLOB option. You can take a look at:

http://msdn.microsoft.com/library/en-us/dnsql90/html/sql2k5xml.asp?frame=true

|||

This works a treat, many thanks for thank.

I've notice it doesn't like inserting into nulls or primary keys, but I shall look into that now.

Cheers again great advice

Copying views

I have two databases A & B, I copied all of the tabels and data from A
to B. I can't figure out how to copy the Views and Stored procedures
from A to B. As you can see I'm new at this, can anyone point me in
the right direction? Oh... forgot running SQL 2000.

Thanks[posted and mailed, please reply in news]

Jim Davidson (raccoon@.icubed.com) writes:
> I have two databases A & B, I copied all of the tabels and data from A
> to B. I can't figure out how to copy the Views and Stored procedures
> from A to B. As you can see I'm new at this, can anyone point me in
> the right direction? Oh... forgot running SQL 2000.

If you want to make a complete copy of a database, there are certainly
easier ways to go. The below assumes that you run Query Analyzer:

exec sp_helpdb yourdb
-- Make notice of the values in the name and filename columns. (Cut
-- and paste to query window.)

BACKUP DATABASE yourdb TO DISK = 'C:\temp\yourbackup.bak'
RESTORE DATABASE yourdbcopy FROM DISK = 'C:\temp\yourbackup.bak'
WITH MOVE 'yourdb' TO 'C:\MSSQL\Data\copyofyourdb.mdf',
MOVE 'yourdblog' TO 'C:\MSSQL\Data\copyofyourdb.ldf',
REPLACE
EXEC master..xp_cmdshell 'DEL C:\temp\yourbackup.bak'

In the RESTORE command replace yourdb and yourdblog with the values
from the name column in the sp_helpdb output, and in paths, replace
the directory paths with the value from the filename columns. You
must change the file name.

Note that RESTORE DATABASE creates the database if it does not exist.

You can also do the backup and restore stuff from Enterprise Manager,
but I am more confident with the T-SQL commands, so I cannot describe
those dialogs.

An alternative, is to use sp_detach_db, copy the database files and
then use sp_attach_db on the copy and the original.

As for the original question, the answer is that you should maintain
all your SQL objects under version control and reload from the source
there. You can also use the scripting facilities in Enterprise
Manager. Right-click the database, and select All Tasks and then
Generate SQL Scripts.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Monday, March 19, 2012

Copying large amount of data form MS Excel to MS Sql Server

Hi ,
I have got a senario in which large amount of data should be copied from MS excel to MS SQL server. which is the best option to do so. Because when I use recordsets the process is very slow and it effects the performance. Any one please suggest me.

Thanks
Anish

Quote:

Originally Posted by AnishAbs

Hi ,
I have got a senario in which large amount of data should be copied from MS excel to MS SQL server. which is the best option to do so. Because when I use recordsets the process is very slow and it effects the performance. Any one please suggest me.

Thanks
Anish


HI Anish,
I am working on sql2005.in this right click on thedatabase
-->go to all tasks .
---->select import data.
--->select msexcel
---->enter the exel file path
---->select all data in exel
---->click on finish.

i think it is also works in sql2000. in 2000 you have to do it enterprise manager|||hi,
if the no of records are greater than 67000 in excel,it is not possible to copy to sql server.you need to split that excel into different files.
if you can copy that excel to MSaccess you can send large data to sql server
through dts only.|||Hi,

Use the Import/Export wizard to import the excel file into you destination database.

Cheers.

copying DBs w/out Copy Wizard

Is it a bad thing to do a manual copy of all my databases
from one server to another in Win Exp? Will it hurt
anything? I detached the DB, copied it over, and then
reattached on the new server. ?Detach/attach is the way the copy database wizard does it as well, so that
is fine.
The other option is to do a backup, copy the backup and then do a restore on
the new server.
--
Jacco Schalkwijk
SQL Server MVP
"kb" <anonymous@.discussions.microsoft.com> wrote in message
news:001b01c393f8$661599d0$a301280a@.phx.gbl...
> Is it a bad thing to do a manual copy of all my databases
> from one server to another in Win Exp? Will it hurt
> anything? I detached the DB, copied it over, and then
> reattached on the new server. ?|||If you're concerned run DBCC CHECKDB after you have successfully attached
the db. If the file is very large > 40Gb I generally use robocopy
--
HTH
Ryan Waight, MCDBA, MCSE
"kb" <anonymous@.discussions.microsoft.com> wrote in message
news:001b01c393f8$661599d0$a301280a@.phx.gbl...
> Is it a bad thing to do a manual copy of all my databases
> from one server to another in Win Exp? Will it hurt
> anything? I detached the DB, copied it over, and then
> reattached on the new server. ?|||See if these help:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
http://www.support.microsoft.com/?id=307775 Disaster Recovery Articles
for SQL Server
http://www.support.microsoft.com/?id=274463 Copy DB
Wizard issues
Andrew J. Kelly
SQL Server MVP
"kb" <anonymous@.discussions.microsoft.com> wrote in message
news:001b01c393f8$661599d0$a301280a@.phx.gbl...
> Is it a bad thing to do a manual copy of all my databases
> from one server to another in Win Exp? Will it hurt
> anything? I detached the DB, copied it over, and then
> reattached on the new server. ?

Saturday, February 25, 2012

Copying a database...

I've used the backup/restore method of copying a database. The only problem
is that all the tables aren't getting copied! There are supposed to be 74
tables but only 60 are coming across--I haven't checked other kinds of
objects.
I've done it twice with the same result. I've been very careful to select
full backup when generating the *.bak file. Any ideas? Please?
Mike...
"...after all He's not a tame lion..."
mporter (mporter@.discussions.microsoft.com) writes:
> I've used the backup/restore method of copying a database. The only
> problem is that all the tables aren't getting copied! There are supposed
> to be 74 tables but only 60 are coming across--I haven't checked other
> kinds of objects.
> I've done it twice with the same result. I've been very careful to select
> full backup when generating the *.bak file. Any ideas? Please?
If you did:
BACKUP DATABASE db TO DISK = 'C:\mybackup.bak'
and there already was a a backup in that file, you did not overwrite it,
but you appended.
Do a RESTORE HEADERONLY on the backup file.
In the future, if you don't wish to keep the old backup, add WITH INIT
to the BACKUP command.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
|||Hi,
Donot overwrite the media file or disk file.
from
killer

Copying a database...

I've used the backup/restore method of copying a database. The only problem
is that all the tables aren't getting copied! There are supposed to be 74
tables but only 60 are coming across--I haven't checked other kinds of
objects.
I've done it twice with the same result. I've been very careful to select
full backup when generating the *.bak file. Any ideas? Please?
Mike...
"...after all He's not a tame lion..."mporter (mporter@.discussions.microsoft.com) writes:
> I've used the backup/restore method of copying a database. The only
> problem is that all the tables aren't getting copied! There are supposed
> to be 74 tables but only 60 are coming across--I haven't checked other
> kinds of objects.
> I've done it twice with the same result. I've been very careful to select
> full backup when generating the *.bak file. Any ideas? Please?
If you did:
BACKUP DATABASE db TO DISK = 'C:\mybackup.bak'
and there already was a a backup in that file, you did not overwrite it,
but you appended.
Do a RESTORE HEADERONLY on the backup file.
In the future, if you don't wish to keep the old backup, add WITH INIT
to the BACKUP command.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Hi,
Donot overwrite the media file or disk file.
from
killer

Copying a database...

I've used the backup/restore method of copying a database. The only problem
is that all the tables aren't getting copied! There are supposed to be 74
tables but only 60 are coming across--I haven't checked other kinds of
objects.
I've done it twice with the same result. I've been very careful to select
full backup when generating the *.bak file. Any ideas? Please?
Mike...
"...after all He's not a tame lion..."mporter (mporter@.discussions.microsoft.com) writes:
> I've used the backup/restore method of copying a database. The only
> problem is that all the tables aren't getting copied! There are supposed
> to be 74 tables but only 60 are coming across--I haven't checked other
> kinds of objects.
> I've done it twice with the same result. I've been very careful to select
> full backup when generating the *.bak file. Any ideas? Please?
If you did:
BACKUP DATABASE db TO DISK = 'C:\mybackup.bak'
and there already was a a backup in that file, you did not overwrite it,
but you appended.
Do a RESTORE HEADERONLY on the backup file.
In the future, if you don't wish to keep the old backup, add WITH INIT
to the BACKUP command.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp|||Hi,
Donot overwrite the media file or disk file.
from
killer

Friday, February 17, 2012

Copy Table

How can I copy the table structure only (no data) keeping foreing key, indexes ...etc. I used DTS and it copied the table but not the relationship to other tables of index information
Thanks
Use Enterprise Manager to script the table. Just right click on the table
and select 'Generate SQL script', from the 'All tasks...' menu. Choose
appropriate options.
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:0130896A-7E01-409A-B111-3788CFD58522@.microsoft.com...
> How can I copy the table structure only (no data) keeping foreing key,
indexes ...etc. I used DTS and it copied the table but not the relationship
to other tables of index information
> Thanks

Copy Table

How can I copy the table structure only (no data) keeping foreing key, indexes ...etc. I used DTS and it copied the table but not the relationship to other tables of index information
ThanksUse Enterprise Manager to script the table. Just right click on the table
and select 'Generate SQL script', from the 'All tasks...' menu. Choose
appropriate options.
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:0130896A-7E01-409A-B111-3788CFD58522@.microsoft.com...
> How can I copy the table structure only (no data) keeping foreing key,
indexes ...etc. I used DTS and it copied the table but not the relationship
to other tables of index information
> Thanks

Copy Table

How can I copy the table structure only (no data) keeping foreing key, index
es ...etc. I used DTS and it copied the table but not the relationship to o
ther tables of index information
ThanksUse Enterprise Manager to script the table. Just right click on the table
and select 'Generate SQL script', from the 'All tasks...' menu. Choose
appropriate options.
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Niles" <Niles@.discussions.microsoft.com> wrote in message
news:0130896A-7E01-409A-B111-3788CFD58522@.microsoft.com...
> How can I copy the table structure only (no data) keeping foreing key,
indexes ...etc. I used DTS and it copied the table but not the relationship
to other tables of index information
> Thanks

Copy Stored Procedures from one server to another

I am moving a database from SQL Server 2005 to SQL Server 2005 Express
running on a laptop for a demo. I have the database tables and data copied,
but am unable to copy the stored procedures. How do I do this?
Thanks,
Mike Ober.
You can either use dts and the copy objects or use
a script like this:
generate script for stored procedures in dependency order
http://www.eggheadcafe.com/articles/20030609.asp
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>
|||The fastest way would be to detach the database copy the mdf and ldf files
to the laptop and attach them there.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>
|||Hi,
Take a look into the below URL; this talks about lots of options.
http://www.karaszi.com/SQLServer/inf...ate_script.asp
Thanks
Hari
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>
|||Hi
Open them in enterprise manager then "cut and paste" them to notepad
files.
Hope this helps
The Grand Master Programmer
Hari Prasad wrote:[vbcol=seagreen]
> Hi,
> Take a look into the below URL; this talks about lots of options.
> http://www.karaszi.com/SQLServer/inf...ate_script.asp
> Thanks
> Hari
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
|||That worked - I had to delete and recreate the service account on the
laptop, but that wasn't a big deal.
Thanks,
Mike.
"Roger Wolter[MSFT]" <rwolter@.online.microsoft.com> wrote in message
news:%23CJI9xn5GHA.2524@.TK2MSFTNGP06.phx.gbl...
> The fastest way would be to detach the database copy the mdf and ldf files
> to the laptop and attach them there.
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>
|||Robbe,
Thanks for the link to the adonet source code generator.
Mike Ober.
"Robbe Morris [C# MVP]" <joeblow@.joe.com> wrote in message
news:%23Ay1FQn5GHA.2292@.TK2MSFTNGP04.phx.gbl...
> You can either use dts and the copy objects or use
> a script like this:
> generate script for stored procedures in dependency order
> http://www.eggheadcafe.com/articles/20030609.asp
> --
> Robbe Morris - 2004-2006 Microsoft MVP C#
> I've mapped the database to .NET class properties and methods to
> implement an multi-layered object oriented environment for your
> data access layer. Thus, you should rarely ever have to type the words
> SqlCommand, SqlDataAdapter, or SqlConnection again.
> http://www.eggheadcafe.com/articles/..._generator.asp
>
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>

Copy Stored Procedures from one server to another

I am moving a database from SQL Server 2005 to SQL Server 2005 Express
running on a laptop for a demo. I have the database tables and data copied,
but am unable to copy the stored procedures. How do I do this?
Thanks,
Mike Ober.
You can either use dts and the copy objects or use
a script like this:
generate script for stored procedures in dependency order
http://www.eggheadcafe.com/articles/20030609.asp
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>
|||The fastest way would be to detach the database copy the mdf and ldf files
to the laptop and attach them there.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>
|||Hi,
Take a look into the below URL; this talks about lots of options.
http://www.karaszi.com/SQLServer/inf...ate_script.asp
Thanks
Hari
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>
|||Hi
Open them in enterprise manager then "cut and paste" them to notepad
files.
Hope this helps
The Grand Master Programmer
Hari Prasad wrote:[vbcol=seagreen]
> Hi,
> Take a look into the below URL; this talks about lots of options.
> http://www.karaszi.com/SQLServer/inf...ate_script.asp
> Thanks
> Hari
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
|||That worked - I had to delete and recreate the service account on the
laptop, but that wasn't a big deal.
Thanks,
Mike.
"Roger Wolter[MSFT]" <rwolter@.online.microsoft.com> wrote in message
news:%23CJI9xn5GHA.2524@.TK2MSFTNGP06.phx.gbl...
> The fastest way would be to detach the database copy the mdf and ldf files
> to the laptop and attach them there.
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>
|||Robbe,
Thanks for the link to the adonet source code generator.
Mike Ober.
"Robbe Morris [C# MVP]" <joeblow@.joe.com> wrote in message
news:%23Ay1FQn5GHA.2292@.TK2MSFTNGP04.phx.gbl...
> You can either use dts and the copy objects or use
> a script like this:
> generate script for stored procedures in dependency order
> http://www.eggheadcafe.com/articles/20030609.asp
> --
> Robbe Morris - 2004-2006 Microsoft MVP C#
> I've mapped the database to .NET class properties and methods to
> implement an multi-layered object oriented environment for your
> data access layer. Thus, you should rarely ever have to type the words
> SqlCommand, SqlDataAdapter, or SqlConnection again.
> http://www.eggheadcafe.com/articles/..._generator.asp
>
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>

Copy Stored Procedures from one server to another

I am moving a database from SQL Server 2005 to SQL Server 2005 Express
running on a laptop for a demo. I have the database tables and data copied,
but am unable to copy the stored procedures. How do I do this?
Thanks,
Mike Ober.You can either use dts and the copy objects or use
a script like this:
generate script for stored procedures in dependency order
http://www.eggheadcafe.com/articles/20030609.asp
--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||The fastest way would be to detach the database copy the mdf and ldf files
to the laptop and attach them there.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||Hi,
Take a look into the below URL; this talks about lots of options.
http://www.karaszi.com/SQLServer/info_generate_script.asp
Thanks
Hari
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||Hi
Open them in enterprise manager then "cut and paste" them to notepad
files.
Hope this helps
The Grand Master Programmer
Hari Prasad wrote:
> Hi,
> Take a look into the below URL; this talks about lots of options.
> http://www.karaszi.com/SQLServer/info_generate_script.asp
> Thanks
> Hari
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
> >I am moving a database from SQL Server 2005 to SQL Server 2005 Express
> >running on a laptop for a demo. I have the database tables and data
> >copied, but am unable to copy the stored procedures. How do I do this?
> >
> > Thanks,
> > Mike Ober.
> >
> >|||That worked - I had to delete and recreate the service account on the
laptop, but that wasn't a big deal.
Thanks,
Mike.
"Roger Wolter[MSFT]" <rwolter@.online.microsoft.com> wrote in message
news:%23CJI9xn5GHA.2524@.TK2MSFTNGP06.phx.gbl...
> The fastest way would be to detach the database copy the mdf and ldf files
> to the laptop and attach them there.
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>>running on a laptop for a demo. I have the database tables and data
>>copied, but am unable to copy the stored procedures. How do I do this?
>> Thanks,
>> Mike Ober.
>>
>|||Robbe,
Thanks for the link to the adonet source code generator.
Mike Ober.
"Robbe Morris [C# MVP]" <joeblow@.joe.com> wrote in message
news:%23Ay1FQn5GHA.2292@.TK2MSFTNGP04.phx.gbl...
> You can either use dts and the copy objects or use
> a script like this:
> generate script for stored procedures in dependency order
> http://www.eggheadcafe.com/articles/20030609.asp
> --
> Robbe Morris - 2004-2006 Microsoft MVP C#
> I've mapped the database to .NET class properties and methods to
> implement an multi-layered object oriented environment for your
> data access layer. Thus, you should rarely ever have to type the words
> SqlCommand, SqlDataAdapter, or SqlConnection again.
> http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
>
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>>running on a laptop for a demo. I have the database tables and data
>>copied, but am unable to copy the stored procedures. How do I do this?
>> Thanks,
>> Mike Ober.
>>
>

Copy Stored Procedures from one server to another

I am moving a database from SQL Server 2005 to SQL Server 2005 Express
running on a laptop for a demo. I have the database tables and data copied,
but am unable to copy the stored procedures. How do I do this?
Thanks,
Mike Ober.You can either use dts and the copy objects or use
a script like this:
generate script for stored procedures in dependency order
http://www.eggheadcafe.com/articles/20030609.asp
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles...e_generator.asp
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||The fastest way would be to detach the database copy the mdf and ldf files
to the laptop and attach them there.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||Hi,
Take a look into the below URL; this talks about lots of options.
http://www.karaszi.com/SQLServer/in...rate_script.asp
Thanks
Hari
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||Hi
Open them in enterprise manager then "cut and paste" them to notepad
files.
Hope this helps
The Grand Master Programmer
Hari Prasad wrote:[vbcol=seagreen]
> Hi,
> Take a look into the below URL; this talks about lots of options.
> http://www.karaszi.com/SQLServer/in...rate_script.asp
> Thanks
> Hari
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...|||That worked - I had to delete and recreate the service account on the
laptop, but that wasn't a big deal.
Thanks,
Mike.
"Roger Wolter[MSFT]" <rwolter@.online.microsoft.com> wrote in message
news:%23CJI9xn5GHA.2524@.TK2MSFTNGP06.phx.gbl...
> The fastest way would be to detach the database copy the mdf and ldf files
> to the laptop and attach them there.
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>|||Robbe,
Thanks for the link to the adonet source code generator.
Mike Ober.
"Robbe Morris [C# MVP]" <joeblow@.joe.com> wrote in message
news:%23Ay1FQn5GHA.2292@.TK2MSFTNGP04.phx.gbl...
> You can either use dts and the copy objects or use
> a script like this:
> generate script for stored procedures in dependency order
> http://www.eggheadcafe.com/articles/20030609.asp
> --
> Robbe Morris - 2004-2006 Microsoft MVP C#
> I've mapped the database to .NET class properties and methods to
> implement an multi-layered object oriented environment for your
> data access layer. Thus, you should rarely ever have to type the words
> SqlCommand, SqlDataAdapter, or SqlConnection again.
> http://www.eggheadcafe.com/articles...e_generator.asp
>
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>

Copy stored procedure?

I copied a database using export wizard, but that doesnt copy the stored procedures in the database. I know that dts needs to be used to copy stored procedures, but can someone give me a bit more explanation on how this is to be done? Any help is greatly appreciated.

Try the link below for two easy ways to do it. Hope this helps.

http://www.dotnetspider.com/qa/Question13042.aspx

Monday, February 13, 2012

Copy SQL 7.0 db to SQL 2k

Hi all;
Is there a procedure to copy a database from 7.0 to 2K or can in fact a 7.0
db be copied into 2K?
Do I have to perform a backup/restore situation for this db or are there
possibly some CLI commands for a db copy?
Thanks in advance.
Steve
There is no "Copy" command per say but you can either do a Restore or a
sp_attach_db. Both operations will take a 7.0 db and upgrade it to a 2000
db and leave the data and objects etc intact.
Andrew J. Kelly SQL MVP
"Steve" <Steve@.discussions.microsoft.com> wrote in message
news:F4B16A4D-126A-4BDA-A16D-8BB57CD7A301@.microsoft.com...
> Hi all;
> Is there a procedure to copy a database from 7.0 to 2K or can in fact a
> 7.0
> db be copied into 2K?
> Do I have to perform a backup/restore situation for this db or are there
> possibly some CLI commands for a db copy?
> Thanks in advance.
> Steve
|||Hi Steve,
One of the easiest method is using backup/restore.
Thanks
Yogish
|||Keep in mind the collation type...
--
Sasan Saidi
MSc in CS, MCSE4, IBM Certified MQ 5.3 Administrator
Senior DBA
"Yogish" wrote:

> Hi Steve,
> One of the easiest method is using backup/restore.
> --
> Thanks
> Yogish

Copy SQL 7.0 db to SQL 2k

Hi all;
Is there a procedure to copy a database from 7.0 to 2K or can in fact a 7.0
db be copied into 2K?
Do I have to perform a backup/restore situation for this db or are there
possibly some CLI commands for a db copy?
Thanks in advance.
SteveThere is no "Copy" command per say but you can either do a Restore or a
sp_attach_db. Both operations will take a 7.0 db and upgrade it to a 2000
db and leave the data and objects etc intact.
--
Andrew J. Kelly SQL MVP
"Steve" <Steve@.discussions.microsoft.com> wrote in message
news:F4B16A4D-126A-4BDA-A16D-8BB57CD7A301@.microsoft.com...
> Hi all;
> Is there a procedure to copy a database from 7.0 to 2K or can in fact a
> 7.0
> db be copied into 2K?
> Do I have to perform a backup/restore situation for this db or are there
> possibly some CLI commands for a db copy?
> Thanks in advance.
> Steve|||Hi Steve,
One of the easiest method is using backup/restore.
--
Thanks
Yogish|||Keep in mind the collation type...
--
--
Sasan Saidi
MSc in CS, MCSE4, IBM Certified MQ 5.3 Administrator
Senior DBA
"Yogish" wrote:
> Hi Steve,
> One of the easiest method is using backup/restore.
> --
> Thanks
> Yogish

Copy SQL 7.0 db to SQL 2k

Hi all;
Is there a procedure to copy a database from 7.0 to 2K or can in fact a 7.0
db be copied into 2K?
Do I have to perform a backup/restore situation for this db or are there
possibly some CLI commands for a db copy?
Thanks in advance.
SteveThere is no "Copy" command per say but you can either do a Restore or a
sp_attach_db. Both operations will take a 7.0 db and upgrade it to a 2000
db and leave the data and objects etc intact.
Andrew J. Kelly SQL MVP
"Steve" <Steve@.discussions.microsoft.com> wrote in message
news:F4B16A4D-126A-4BDA-A16D-8BB57CD7A301@.microsoft.com...
> Hi all;
> Is there a procedure to copy a database from 7.0 to 2K or can in fact a
> 7.0
> db be copied into 2K?
> Do I have to perform a backup/restore situation for this db or are there
> possibly some CLI commands for a db copy?
> Thanks in advance.
> Steve|||Hi Steve,
One of the easiest method is using backup/restore.
Thanks
Yogish|||Keep in mind the collation type...
--
Sasan Saidi
MSc in CS, MCSE4, IBM Certified MQ 5.3 Administrator
Senior DBA
"Yogish" wrote:

> Hi Steve,
> One of the easiest method is using backup/restore.
> --
> Thanks
> Yogish