Showing posts with label guysi. Show all posts
Showing posts with label guysi. Show all posts

Thursday, March 22, 2012

Database Backup Issue

Hi Guys
I have been working on database backups and recently I realised, when I take back up from enterprise manager and by my own scripts, these two files have differ in size like first one is MB and second one is GB.

Procedure One: I Have my own script to take backup
Checking DB Integrity
Rebuilding Table Indexes
Shrinking DB
DB Full backup

Procedure Two: Simply by right clicking on the DB using Enterprise manager.

Your advice will be appreciated.

PoisonHi
Thanks Alot .. I have resolved the issue...|||What was the resolution?|||I would bet that one of the methods was not initializing the backup file, but appending to it.|||Hi Geroge
With my script I was appending the data where as in Enterprise manager I was backing up with over write option...
Its my mistake...|||backup ... with init

Friday, February 17, 2012

Data type conversion issue

Hi guys
I exported some data from a text file to sql server. Here is the sample data..

This table has about 2 million rows.There is a date field in the table which comes as a 'nvarchar' in sql .When i try to convert it to a 'datetime' , i get an error as operation timed out..

Here is the data from the text file...

Date dispensed Outliers Formulation ID Provider Number (dispensing) NSS flag Patient category Units dispensed Total days supply
1/01/2006 12:00:00 a.m. normal 106509.00 7952 I A 120.00 30.00
1/01/2006 12:00:00 a.m. normal 106509.00 8208 I A 360.00 90.00
1/01/2006 12:00:00 a.m. normal 106509.00 9460 I A 120.00 30.00
1/01/2006 12:00:00 a.m. normal 106509.00 10184 I A 120.00 60.00
1/01/2006 12:00:00 a.m. normal 106509.00 10291 I A 120.00 60.00
1/01/2006 12:00:00 a.m. normal 106509.00 11149 I A 120.00 30.00
1/01/2006 12:00:00 a.m. normal 106509.00 11294 I A 120.00 60.00
1/01/2006 12:00:00 a.m. normal 106509.00 11777 I A 120.00 30.00
1/01/2006 12:00:00 a.m. normal 106509.00 12048 I A 120.00 30.00

I have tried the bulk insert as well.

Here is the script for the create table ..

USE [Library]

GO

/****** Object: Table [dbo].[tablename] Script Date: 10/03/2006 14:45:59 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[NormalOutlier1](

[Datedispensed] [nvarchar](max) COLLATE Latin1_General_CI_AS NULL,

[Outliers] [nvarchar](max) COLLATE Latin1_General_CI_AS NULL,

[Formulation ID] [float] NULL,

[Provider Number (dispensing)] [nvarchar](max) COLLATE Latin1_General_CI_AS NULL,

[NSS flag] [nvarchar](max) COLLATE Latin1_General_CI_AS NULL,

[Patient category] [nvarchar](max) COLLATE Latin1_General_CI_AS NULL,

[Units dispensed] [float] NULL,

[Total days supply] [float] NULL

) ON [PRIMARY]

Hope this helps

Did you try using a datetime rather than NVARCHAR(MAX) in the definition of the table ? There might be a implicit conversion possible for the values. if not you will have to convert the dates with your own logic using either an ETL process in DTS / SSIS or just by using a string manipulation.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de