473,786 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to take backup of only the structure of a database in Ms-sql, no need of data.

2 New Member
I need the backup of only the structure of database, not the data.

I tried, this procedure , but it is copying the whole database


create Procedure BackupAlldataba ses

as



declare cur_databases cursor for

select name from master..sysdata bases where name not in
('tempdb','mast er','Northwind' ,'pubs','model' ,'msdb')



open cur_databases



declare @path varchar(100), @DBName varchar(100), @BackupPath
varchar(100), @cleardbs varchar(100),@d ay varchar(2),@mon th
varchar(2),@yea r varchar(4)

set @Path = '\\sdg_bankaler t3\BA_Project_B ackUp\SDG_BA25'


fetch next from cur_databases into @DBName



While (@@fetch_status = 0)

BEGIN

set @month= Case when len(month(getda te()))=1 then
'0'+Cast(month( getdate()) as varchar) else Cast(month(getd ate()) as
varchar) end
set @day=Case when len(day(getdate ()))=1 then '0'+Cast(day(ge tdate()) as
varchar) else Cast(day(getdat e()) as varchar) end
set @year=year( GETDATE() )

--set @BackupPath = @Path + '\'+@month+'-'+
@year+'\'+@mont h+'-'+@day+'-'+ @year+'\'+'sdg_ ba25'+'\'+ @DBName + '.bak'
set @BackupPath = @Path + @DBName + '.bak'
print @BackupPath
backup database @DBName to disk = @BackupPath with init

fetch next from cur_databases into @DBName

END



Please if any one can give me the solution...


With regards,
winsletmathew
Nov 3 '08 #1
4 4430
debasisdas
8,127 Recognized Expert Expert
question moved to sql -server forum.
Nov 3 '08 #2
ck9663
2,878 Recognized Expert Specialist
If it's SQL 2005, open your Management Studio. Open your Object Explorer Detail window. Click on Tables. Just like Windows Explorer, select all tables that you want to backup. Right-click, Script table as, Create to, New Query Window.

Copy the code on your query window, open a text editor, paste everything.

Happy coding!

-- CK
Nov 4 '08 #3
winsletmathew
2 New Member
If it's SQL 2005, open your Management Studio. Open your Object Explorer Detail window. Click on Tables. Just like Windows Explorer, select all tables that you want to backup. Right-click, Script table as, Create to, New Query Window.

Copy the code on your query window, open a text editor, paste everything.

Happy coding!

-- CK

Hello,

The above solution takes a lot of time if if u have many tables..
And if u take many databases , then this process will take a lot of time.

Can u give a command or procedure, which automatically takes the backup of all the structures in the database

With regards,
winsletmathew
Nov 4 '08 #4
ck9663
2,878 Recognized Expert Specialist
You can create script to generate structure of each table. The problem is, you will not able to capture the index, constraints, etc.

You can select multiple tables at a time. You just have to browse to other databases.

Maybe our other members can help as well.

-- CK
Nov 4 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1535
by: vishal | last post by:
hi i am using mysql as backend. my all tables are of MY ISAM type. so how can i take backup of my tables??????? thxs for your reply................
1
1754
by: Leader | last post by:
Hi, I want to take backup of database logfile periodically and automatically. What should i do then..... Thanks Hoque
0
950
by: Joachim Klassen | last post by:
Hi all, a db2 database copy which was splitted from the original during suspend mode can be initialized with "db2inidb as standby" and you can run "db2 backup" against that copy (being in rollforward state). However, the docs say : "If you have only DMS table spaces (database managed space), you can take a full database backup to offload the overhead of taking a backup on the production database." So if for example your SYSCATSPACE is...
0
3793
by: Parv | last post by:
hi all can i attach a read only restored database. I restored a database Test in Stand by Mode. After that i detached that database and while restoring i m getting msg "Cannot attach a database that was being restored.". Is it o that i can not attach a readonly restored detached database ? Parveen Beniwal
0
2272
by: egp | last post by:
Hi guys, I have a database using Ms Access 2003 connected to VB6 using ADODB Connection and I want to know how to: - display Ms Access report in VB using VB code then print it out - backup and restore Ms Access table using VB code - open HTML file using VB code Is there anyone can help me please? It's urgent. Thanks before
0
1464
by: Dan van Ginhoven | last post by:
Hi! I have DB2 9.1 running on a Linux-server. The database is partioned into two nodes on this server. On another Linux-server, acting as application server, I want to initiate the backup. When I issue the backup command from the client server, I get a backup of the controlling node, NODE0000.
3
1307
by: sandhu236 | last post by:
Hi all, Can anyone please help me..to take backup automatically from the frontend application (Java swing) after certain number of records REgards, SAndhya
3
1638
by: DALVI PRITAM | last post by:
How to take tables from oracle database
0
1443
by: vijay bharath | last post by:
how to take backup of database using java by query itself? please help
4
3720
by: vidhyaG | last post by:
Hi... i am developing one application in .net... in that i have to take backup the database.and have to restore the Database.... normally we connect the database from file... i tried some codes but it returns, this file is used by another process...
0
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.