Showing posts with label purpose. Show all posts
Showing posts with label purpose. Show all posts

Wednesday, March 7, 2012

Backup of tables

Hi Guys,

I would like to take a backup of tables and further use them for manipulation purpose.

(e.g.)

Select * into arc_employee_07_07_2005 from employee

Where 07_07_2005 is formatted from getdate().


How can i achieve this formate.

Thanks in advance.

Look at the day, month, year or datepart function. You can use those with string functions to generate the leading 0 also like:

select right('00' + cast(day(current_timestamp) as varchar)), 2)|||Hi JayaChandran

i have just modified ur query to something like this.

select * into Arc_Employee_+(select cast(day(current_timestamp) as varchar)+'_'+
cast(month(current_timestamp) as varchar)+'_'+cast(year(current_timestamp) as varchar))
from Employee

Can you modify the above query. so that the table name should be having a suffix of date. (eg) Ar_TableName_Date.

Thanks in Advance|||You cannot specify an expression as table name for the INTO clause. You have to generate the name and then use dynamic SQL to execute the SELECT INTO statement. If you do not want to use dynamic sql, another option is to do following:

select * into _temp_arc_employee from Employee
exec sp_rename '_temp_arc_employee', 'new name'

This will work only if this is the only connection performing this operation otherwise you will get error due to same name being used for the SELECT...INTO table name from different connections.

Thursday, February 16, 2012

backup log in sqlserver 2000

Hi
I want to activate my standby database.
My primary database is fine and I want to continue to use it for some other
purpose.
My question :
Do I need to use no_truncate option during the remaining transactions backup?
If I use NO_TRUNCATE option can I continue to use my primary database for
other work.
What is the difference between the regular T-LOG bkup and backup with
NO_TRUNCATE option.
Tks
MangeshNo, you shouldn't use NO_TRUNCATE. This is only there to support backing up log of a corrupted
database. See http://www.karaszi.com/SQLServer/info_restore_no_truncate.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Mangesh Deshpande" <MangeshDeshpande@.discussions.microsoft.com> wrote in message
news:49D98498-C81E-4B7C-B117-F8E5AB7B7E3B@.microsoft.com...
> Hi
> I want to activate my standby database.
> My primary database is fine and I want to continue to use it for some other
> purpose.
> My question :
> Do I need to use no_truncate option during the remaining transactions backup?
> If I use NO_TRUNCATE option can I continue to use my primary database for
> other work.
> What is the difference between the regular T-LOG bkup and backup with
> NO_TRUNCATE option.
> Tks
> Mangesh|||Hi,
Backup Log command is used to backup the transaction log when database is
accessible. NO_TRUNCATE option is used when a database is inaccessi le and
you need to take a log backup. See the detailed explanation by tibor:-
http://www.karaszi.com/SQLServer/info_restore_no_truncate.asp
Thanks
Hari
SQL server MVP
"Mangesh Deshpande" <MangeshDeshpande@.discussions.microsoft.com> wrote in
message news:49D98498-C81E-4B7C-B117-F8E5AB7B7E3B@.microsoft.com...
> Hi
> I want to activate my standby database.
> My primary database is fine and I want to continue to use it for some
> other
> purpose.
> My question :
> Do I need to use no_truncate option during the remaining transactions
> backup?
> If I use NO_TRUNCATE option can I continue to use my primary database for
> other work.
> What is the difference between the regular T-LOG bkup and backup with
> NO_TRUNCATE option.
> Tks
> Mangesh