Showing posts with label files. Show all posts
Showing posts with label files. Show all posts

Friday, March 30, 2012

help importing large flat file into relational tables

I am trying to find the best (fastest) way to import large text files into
sql server 2005 relational tables. The database has simple recovery model.
The total size of data to be load is about 1gb (each file)
source:
Multiple source files with different layout.
Destination:
3 sql server tables; a parent table with a ID (IDENTITY) primary key and a 3
column unique index (alternate key) and a detail table that has a DETAIL_ID
(IDENTITY) primary key and a foreign key ID to the parent table.
So, for each source file, I need to convert some columns to decimal and
separate the data into parent and detail tables.
Here is one way to do this:
For each source file
* use a thread for each file with Microsoft Visual Studio .NET 2003
* run insert query with SP's por each record, and join parent table with
details.
* process next record
My app works fine in XP and SQL express, When I run the queries the CPU
utilization is consitantly around 90%. This is my development environment.
My production enviroment is with SQL 2005 and Win 2003 Enterprise Edition Sp1.
When I run the queries the CPU utilization is consitantly around 3%.
I have 2 Questions:
1- Is there a better way to do this?
2- Why XP has utilization around 90%, and Win2003 3%?
Speed is the primary concern.
Thank you for any suggestions.
Macisu wrote:
> I am trying to find the best (fastest) way to import large text files into
> sql server 2005 relational tables. The database has simple recovery model.
> The total size of data to be load is about 1gb (each file)
> source:
> Multiple source files with different layout.
>
> Destination:
> 3 sql server tables; a parent table with a ID (IDENTITY) primary key and a 3
> column unique index (alternate key) and a detail table that has a DETAIL_ID
> (IDENTITY) primary key and a foreign key ID to the parent table.
>
> So, for each source file, I need to convert some columns to decimal and
> separate the data into parent and detail tables.
> Here is one way to do this:
> For each source file
> * use a thread for each file with Microsoft Visual Studio .NET 2003
> * run insert query with SP's por each record, and join parent table with
> details.
> * process next record
> My app works fine in XP and SQL express, When I run the queries the CPU
> utilization is consitantly around 90%. This is my development environment.
> My production enviroment is with SQL 2005 and Win 2003 Enterprise Edition Sp1.
> When I run the queries the CPU utilization is consitantly around 3%.
> I have 2 Questions:
> 1- Is there a better way to do this?
> 2- Why XP has utilization around 90%, and Win2003 3%?
>
> Speed is the primary concern.
> Thank you for any suggestions.
SQL Server Integration Services is the most obvious solution to try.
Read about Integration Services in Books Online. Depending on the
format of your files BCP may also be an option.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx

help importing large flat file into relational tables

I am trying to find the best (fastest) way to import large text files into sql server 2000 relational tables. The database has simple recovery model.

The total size of data to be load is about 1gb (each file)

source:

Multiple source files with different layout.


Destination:

3 sql server tables; a parent table with a ID (IDENTITY) primary key and a 3 column unique index (alternate key) and a detail table that has a DETAIL_ID (IDENTITY) primary key and a foreign key ID to the parent table.


So, for each source file, I need to convert some columns to decimal and separate the data into parent and detail tables.

Here is one way to do this:

For each source file

* use a thread for each file with Microsoft Visual Studio .NET 2003

* run insert query with SP's por each record, and join parent table with details.

* process next record

My app works fine in XP and SQL express, When I run the queries the CPU utilization is consitantly around 90%. This is my development environment.

My production enviroment is with SQL 2005 and Win 2003 Enterprise Edition Sp1.

When I run the queries the CPU utilization is consitantly around 3%.

I have 2 Questions:

1- Is there a better way to do this?

2- Why XP has utilization around 90%, and Win2003 3%?

Speed is the primary concern.

Thank you for any suggestions.

Using SPs calls is not the fastest way. The quickest way is to generate files including the identity values and then bcp/.bulk insert the data into SQL. You could use SSIS to do this as well.

The reason you should generate you ID values outside of the database is so that when spliting your input file into your tables you can just insert the data straight into the tables. You can let SQL generate the PK identity values of the detail tables.

help importing large flat file into relational tables

I am trying to find the best (fastest) way to import large text files into
sql server 2005 relational tables. The database has simple recovery model.
The total size of data to be load is about 1gb (each file)
source:
Multiple source files with different layout.
Destination:
3 sql server tables; a parent table with a ID (IDENTITY) primary key and a 3
column unique index (alternate key) and a detail table that has a DETAIL_ID
(IDENTITY) primary key and a foreign key ID to the parent table.
So, for each source file, I need to convert some columns to decimal and
separate the data into parent and detail tables.
Here is one way to do this:
For each source file
* use a thread for each file with Microsoft Visual Studio .NET 2003
* run insert query with SP's por each record, and join parent table with
details.
* process next record
My app works fine in XP and SQL express, When I run the queries the CPU
utilization is consitantly around 90%. This is my development environment.
My production enviroment is with SQL 2005 and Win 2003 Enterprise Edition Sp
1.
When I run the queries the CPU utilization is consitantly around 3%.
I have 2 Questions:
1- Is there a better way to do this?
2- Why XP has utilization around 90%, and Win2003 3%?
Speed is the primary concern.
Thank you for any suggestions.Macisu wrote:
> I am trying to find the best (fastest) way to import large text files into
> sql server 2005 relational tables. The database has simple recovery model.
> The total size of data to be load is about 1gb (each file)
> source:
> Multiple source files with different layout.
>
> Destination:
> 3 sql server tables; a parent table with a ID (IDENTITY) primary key and a
3
> column unique index (alternate key) and a detail table that has a DETAIL_I
D
> (IDENTITY) primary key and a foreign key ID to the parent table.
>
> So, for each source file, I need to convert some columns to decimal and
> separate the data into parent and detail tables.
> Here is one way to do this:
> For each source file
> * use a thread for each file with Microsoft Visual Studio .NET 2003
> * run insert query with SP's por each record, and join parent table with
> details.
> * process next record
> My app works fine in XP and SQL express, When I run the queries the CPU
> utilization is consitantly around 90%. This is my development environment.
> My production enviroment is with SQL 2005 and Win 2003 Enterprise Edition
Sp1.
> When I run the queries the CPU utilization is consitantly around 3%.
> I have 2 Questions:
> 1- Is there a better way to do this?
> 2- Why XP has utilization around 90%, and Win2003 3%?
>
> Speed is the primary concern.
> Thank you for any suggestions.
SQL Server Integration Services is the most obvious solution to try.
Read about Integration Services in Books Online. Depending on the
format of your files BCP may also be an option.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

help importing large flat file into relational tables

I am trying to find the best (fastest) way to import large text files into
sql server 2005 relational tables. The database has simple recovery model.
The total size of data to be load is about 1gb (each file)
source:
Multiple source files with different layout.
Destination:
3 sql server tables; a parent table with a ID (IDENTITY) primary key and a 3
column unique index (alternate key) and a detail table that has a DETAIL_ID
(IDENTITY) primary key and a foreign key ID to the parent table.
So, for each source file, I need to convert some columns to decimal and
separate the data into parent and detail tables.
Here is one way to do this:
For each source file
* use a thread for each file with Microsoft Visual Studio .NET 2003
* run insert query with SP's por each record, and join parent table with
details.
* process next record
My app works fine in XP and SQL express, When I run the queries the CPU
utilization is consitantly around 90%. This is my development environment.
My production enviroment is with SQL 2005 and Win 2003 Enterprise Edition Sp1.
When I run the queries the CPU utilization is consitantly around 3%.
I have 2 Questions:
1- Is there a better way to do this?
2- Why XP has utilization around 90%, and Win2003 3%?
Speed is the primary concern.
Thank you for any suggestions.Macisu wrote:
> I am trying to find the best (fastest) way to import large text files into
> sql server 2005 relational tables. The database has simple recovery model.
> The total size of data to be load is about 1gb (each file)
> source:
> Multiple source files with different layout.
>
> Destination:
> 3 sql server tables; a parent table with a ID (IDENTITY) primary key and a 3
> column unique index (alternate key) and a detail table that has a DETAIL_ID
> (IDENTITY) primary key and a foreign key ID to the parent table.
>
> So, for each source file, I need to convert some columns to decimal and
> separate the data into parent and detail tables.
> Here is one way to do this:
> For each source file
> * use a thread for each file with Microsoft Visual Studio .NET 2003
> * run insert query with SP's por each record, and join parent table with
> details.
> * process next record
> My app works fine in XP and SQL express, When I run the queries the CPU
> utilization is consitantly around 90%. This is my development environment.
> My production enviroment is with SQL 2005 and Win 2003 Enterprise Edition Sp1.
> When I run the queries the CPU utilization is consitantly around 3%.
> I have 2 Questions:
> 1- Is there a better way to do this?
> 2- Why XP has utilization around 90%, and Win2003 3%?
>
> Speed is the primary concern.
> Thank you for any suggestions.
SQL Server Integration Services is the most obvious solution to try.
Read about Integration Services in Books Online. Depending on the
format of your files BCP may also be an option.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

HELP HELP!..............................

Hi All,
I'm trying to move the master database data and log files
to the new location. I did follow the following
instruction with no luck. I can NOT start SQLServices I
make the changes. Please help me to fix this or pointing
me to the right direction on how to fix this.
1. Remove the current entries for the Master.mdf and
Mastlog.ldf files.
2. Add new entries specifying the new location:
-dE:\SQLDATA\master.mdf
-lE:\SQLDATA\mastlog.ldf
3. Stop SQL Server.
4. Copy the Master.mdf and Mastlog.ldf files to the new
location (E:\Sqldata).
5. Restart SQL Server.
tomHi Tom,
I tried the steps directed by you, and guess what, I was able to restart
the SQL Services on my machine.
IMPORTANT: This article contains information about editing the registry.
Before you edit the registry, you should first make a backup copy of the
registry files (System.dat and User.dat). Both are hidden files in the
Windows folder.
WARNING: Using Registry Editor incorrectly can cause serious problems that
may require you to reinstall Operating System. Microsoft cannot guarantee
that problems resulting from the incorrect use of Registry Editor can be
solved. Use Registry Editor at your own risk.
Anyways, you can find the entry related to the SQL Server Parameters in the
registry at the following location
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\Parameters
Please verify the value of the parameters, for any misspells.
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.|||The best way to do this is to use the enterprise manager. Detach the
database, move the files and attach. (VERY simple)
"tuand2001@.yahoo.com" <anonymous@.discussions.microsoft.com> schreef in
bericht news:1b7e701c420cf$3e076e50$a501280a@.phx.gbl...
> Hi All,
> I'm trying to move the master database data and log files
> to the new location. I did follow the following
> instruction with no luck. I can NOT start SQLServices I
> make the changes. Please help me to fix this or pointing
> me to the right direction on how to fix this.
>
> 1. Remove the current entries for the Master.mdf and
> Mastlog.ldf files.
> 2. Add new entries specifying the new location:
> -dE:\SQLDATA\master.mdf
> -lE:\SQLDATA\mastlog.ldf
> 3. Stop SQL Server.
> 4. Copy the Master.mdf and Mastlog.ldf files to the new
> location (E:\Sqldata).
> 5. Restart SQL Server.
> tom|||Hi,
I am sorry but the Master Database, being a System Database, cannot be
detached when the SQL Server Service is running.
Ashish
This posting is provided "AS IS" with no warranties, and confers no rights.

Monday, March 26, 2012

help files in English (QA)

Dear fellows,
From my workstation I've got QA and its help files, in spanish. I'd like to
have in english and so I would avoid to use Terminal Server (against
production servers) for consult that info in English...
Is there any way for to change this?
Thanks a lot for any input or advice,
--
Please post DDL, DCL and DML statements as well as any error message in
order to understand better your request. It''s hard to provide information
without seeing the code. location: Alicante (ES)The support files for Books Online are stored in the following location:
C:\Program Files\Microsoft SQL Server\80\Tools\Books
The link is as follows:
C:\WINDOWS\hh.exe "C:\Program Files\Microsoft SQL
Server\80\Tools\Books\SQL80.col"
You could create a new folder like the following and copy the files from
another workstation that had an Engligh install:
C:\Program Files\Microsoft SQL Server\80\Tools\Books_EN
Once done, create a new shortcut on your desktop for the following:
C:\WINDOWS\hh.exe "C:\Program Files\Microsoft SQL
Server\80\Tools\Books_EN\SQL80.col"
I would expect that only one version of BOL can be linked with QA, EM and
the other client tools, so you would need to access the Engligh verison of
the documentation using the above shortcut.
Also, there is MSDN.com
"Enric" <vtam13@.terra.es.(donotspam)> wrote in message
news:E90A46EB-EBFD-4967-ADF9-FD5030B0F1A7@.microsoft.com...
> Dear fellows,
> From my workstation I've got QA and its help files, in spanish. I'd like
> to
> have in english and so I would avoid to use Terminal Server (against
> production servers) for consult that info in English...
> Is there any way for to change this?
> Thanks a lot for any input or advice,
> --
> Please post DDL, DCL and DML statements as well as any error message in
> order to understand better your request. It''s hard to provide information
> without seeing the code. location: Alicante (ES)|||hi JT,
Have done but not successful results. my workstaton is in spanish. Maybe
that's the reason. I have 'Archivos de programa' instead of 'Program Files'
--
Please post DDL, DCL and DML statements as well as any error message in
order to understand better your request. It''s hard to provide information
without seeing the code. location: Alicante (ES)
"JT" wrote:

> The support files for Books Online are stored in the following location:
> C:\Program Files\Microsoft SQL Server\80\Tools\Books
> The link is as follows:
> C:\WINDOWS\hh.exe "C:\Program Files\Microsoft SQL
> Server\80\Tools\Books\SQL80.col"
> You could create a new folder like the following and copy the files from
> another workstation that had an Engligh install:
> C:\Program Files\Microsoft SQL Server\80\Tools\Books_EN
> Once done, create a new shortcut on your desktop for the following:
> C:\WINDOWS\hh.exe "C:\Program Files\Microsoft SQL
> Server\80\Tools\Books_EN\SQL80.col"
> I would expect that only one version of BOL can be linked with QA, EM and
> the other client tools, so you would need to access the Engligh verison of
> the documentation using the above shortcut.
> Also, there is MSDN.com
> "Enric" <vtam13@.terra.es.(donotspam)> wrote in message
> news:E90A46EB-EBFD-4967-ADF9-FD5030B0F1A7@.microsoft.com...
>
>|||I don't see why an Engligh (.chm) help file can't be opened; adjust the
folder path to the files as needed. The Engligh characterset is part of a
Spanish language install of Windows.
"Enric" <vtam13@.terra.es.(donotspam)> wrote in message
news:577F1495-5E28-4201-A399-B901E8A13D0C@.microsoft.com...
> hi JT,
> Have done but not successful results. my workstaton is in spanish. Maybe
> that's the reason. I have 'Archivos de programa' instead of 'Program
> Files'
> --
> Please post DDL, DCL and DML statements as well as any error message in
> order to understand better your request. It''s hard to provide information
> without seeing the code. location: Alicante (ES)
>
> "JT" wrote:
>

Help files for MS SQL Management Studio Express?

Hi

Are there any specific Help files to download for SQL Server Management Studio Express. I thought I saw a link the other day, but I am not sure anymore... Or is it part of the Book online for SQL Server Management Express? I can't find reference to Studio in there...

Thanks

Gauguin

Hi,

Here are some links for MS Sql Management Studio Express Help.

-SQL Server 2005 Express Edition Documentation and Samples (December 2005)
-SQL Server 2005 Books Online (December 2005)

HTH,

Michael Castillones

|||

Thanks, the first link was the one I had been looking for.

W

sql

Help files for MS SQL Management Studio Express?

Hi

Are there any specific Help files to download for SQL Server Management Studio Express. I thought I saw a link the other day, but I am not sure anymore... Or is it part of the Book online for SQL Server Management Express? I can't find reference to Studio in there...

Thanks

Gauguin

Hi,

Here are some links for MS Sql Management Studio Express Help.

-SQL Server 2005 Express Edition Documentation and Samples (December 2005)
-SQL Server 2005 Books Online (December 2005)

HTH,

Michael Castillones

|||

Thanks, the first link was the one I had been looking for.

W

Help files for MS SQL Management Studio Express?

Hi

Are there any specific Help files to download for SQL Server Management Studio Express. I thought I saw a link the other day, but I am not sure anymore... Or is it part of the Book online for SQL Server Management Express? I can't find reference to Studio in there...

Thanks

Gauguin

Hi,

Here are some links for MS Sql Management Studio Express Help.

-SQL Server 2005 Express Edition Documentation and Samples (December 2005)
-SQL Server 2005 Books Online (December 2005)

HTH,

Michael Castillones

|||

Thanks, the first link was the one I had been looking for.

W

Help Files driving me crazy

I have broken HTML links all over in my help files. It
drives me nuts. The error I get is :
An error has occured on this page.
Object does not support this property.
What can I do to fix this ? I have Windows XP Professional.reinstall them.
"Jack A" <anonymous@.discussions.microsoft.com> wrote in message
news:f57801c3bdc1$1c798690$a601280a@.phx.gbl...
> I have broken HTML links all over in my help files. It
> drives me nuts. The error I get is :
> An error has occured on this page.
> Object does not support this property.
> What can I do to fix this ? I have Windows XP Professional.

Help Files / Metadata on Reports

I had a pervious thread on a metadata KB but didn't get a response. So I was wondering if anyone has added on a web based help file app to SSRS? Something that you could assign additional metadata to each report. Something that would be searchable.

At this point SSRS doesn't provide enough fields for metadata. I am looking to assign some thing like:

1. Owner/Requestor of report

2. Fields in report

3. Description (other than the one provided)

4. etc..

Does anyone have any ideas of a add on, utility, or software?

Thanks

fsugeiger

Hmmm...I'm not sure I understand what you're asking for, but couldn't you create a report on reports?

In other words, store in your database information about reports, then create a report out of it.

|||Yes, i thought of that but I would have to create a table of report fields and parameters. I didn't want to have to maintain something seperate. i wanted something to read the rdl file and list fields and parameters.

Help Files / Metadata on Reports

I had a pervious thread on a metadata KB but didn't get a response. So I was wondering if anyone has added on a web based help file app to SSRS? Something that you could assign additional metadata to each report. Something that would be searchable.

At this point SSRS doesn't provide enough fields for metadata. I am looking to assign some thing like:

1. Owner/Requestor of report

2. Fields in report

3. Description (other than the one provided)

4. etc..

Does anyone have any ideas of a add on, utility, or software?

Thanks

fsugeiger

Hmmm...I'm not sure I understand what you're asking for, but couldn't you create a report on reports?

In other words, store in your database information about reports, then create a report out of it.

|||Yes, i thought of that but I would have to create a table of report fields and parameters. I didn't want to have to maintain something seperate. i wanted something to read the rdl file and list fields and parameters.sql

Friday, March 23, 2012

help docs for osql.exe parameters

Where can I find help files (.CHM) or other docs on the use of the various
osql.exe command line parameters ?BOL ?
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"John Grandy" <johnagrandy-at-yahoo-dot-com> schrieb im Newsbeitrag
news:udO%236FGbFHA.3932@.TK2MSFTNGP12.phx.gbl...
> Where can I find help files (.CHM) or other docs on the use of the various
> osql.exe command line parameters ?
>|||http://msdn.microsoft.com/library/d...br />
1wxl.asp
"John Grandy" wrote:

> Where can I find help files (.CHM) or other docs on the use of the various
> osql.exe command line parameters ?
>
>|||osql /?
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:u8oRuNGbFHA.3032@.TK2MSFTNGP10.phx.gbl...
> BOL ?
> --
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
> "John Grandy" <johnagrandy-at-yahoo-dot-com> schrieb im Newsbeitrag
> news:udO%236FGbFHA.3932@.TK2MSFTNGP12.phx.gbl...
>|||Hi Mike, and thanks for the response.
Yes, osql -? gives the list of parameters, but isn't there some way to
interactively get help on each parameter?
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:%23GhhXlGbFHA.3144@.TK2MSFTNGP14.phx.gbl...
> osql /?
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
> in message news:u8oRuNGbFHA.3032@.TK2MSFTNGP10.phx.gbl...
>|||In addition to the copy of the Books Online in MSDN that Cris linked to, you
can download a local copy from:
http://www.microsoft.com/downloads/...&displaylang=en
Alan Brewer [MSFT]
Content Architect
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights.|||at the command prompt type:
osql /?
"John Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:udO%236FGbFHA.3932@.TK2MSFTNGP12.phx.gbl...
> Where can I find help files (.CHM) or other docs on the use of the various
> osql.exe command line parameters ?
>|||Not from the SQL Server command prompt utilities like osql. The GUI tools
have their F1 help linked into topics in the Books Online, but not the
command prompt utilities. You get the short list from the utility itself if
you use the /? switch, and you get the more in-depth help from the Books
Online osql reference topic, either online in the MSDN Library or your local
copy.
Alan Brewer [MSFT]
Content Architect
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights.

Help Crash!

Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
directory with all of the MDF and LDF files in it for the databases. Backups
directory was completely lost and as I understand it there are no outside
copies of backups. How if it is at all possible does one get these mounted
in such a way that they can be recovered in a new machine?Hi,
If you have all the Physical DAT files , including Master database . Then
all you have to do is..
1. Take a copy of all DAT files to a safe location
2. Install SQL 7 in the same folder as old installation
3. apply the same service pack as old
4. stop sql server and SQL Server Agent service
5. Copy all the DAT files to the same folder
6. Start SQl server and SQL Server Agent service.
Now your SQl server will be back as old.
Note:
Now onwards please prepare and backup strategy to backup your databases.
Thanks
Hari
MCDBA
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||Read about sp_attach_db and sp_attach_single_file_db in Books Online. These
are only guaranteed to work if you
properly detached the databases first. But if you are lucky...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message news:OcvkKvWeEHA.732@.tk2msftng
p13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases. Backu
ps
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||You can try using sp_attach_db, but if the database wasn't closed properly,
there is no guarantee.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||Copy the LDF and MDF files onto another computer with SQ Lon it and then run
sp_attach_db to attach each DB.
--
Mike Epprecht, Microsoft SQL Server MVP
Johannesburg, South Africa
Mobile: +27-82-552-0268
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||Will it have to be a SQL 7 installation since these came from SQL 7? Or will
it work with SQL 2000 as there are several machines with this installation,
but this may have been the last one remaining with SQL 7 on it
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
> Copy the LDF and MDF files onto another computer with SQ Lon it and then
run
> sp_attach_db to attach each DB.
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Johannesburg, South Africa
> Mobile: +27-82-552-0268
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
> news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Backups
outside[vbcol=seagreen]
mounted[vbcol=seagreen]
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:

> Will it have to be a SQL 7 installation since these came from SQL 7? Or wi
ll
> it work with SQL 2000 as there are several machines with this installation
,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or wi
ll
> it work with SQL 2000 as there are several machines with this installation
,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or wi
ll
> it work with SQL 2000 as there are several machines with this installation
,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or wi
ll
> it work with SQL 2000 as there are several machines with this installation
,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>sql

Help Crash!

Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
directory with all of the MDF and LDF files in it for the databases. Backups
directory was completely lost and as I understand it there are no outside
copies of backups. How if it is at all possible does one get these mounted
in such a way that they can be recovered in a new machine?
Hi,
If you have all the Physical DAT files , including Master database . Then
all you have to do is..
1. Take a copy of all DAT files to a safe location
2. Install SQL 7 in the same folder as old installation
3. apply the same service pack as old
4. stop sql server and SQL Server Agent service
5. Copy all the DAT files to the same folder
6. Start SQl server and SQL Server Agent service.
Now your SQl server will be back as old.
Note:
Now onwards please prepare and backup strategy to backup your databases.
Thanks
Hari
MCDBA
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>
|||Read about sp_attach_db and sp_attach_single_file_db in Books Online. These are only guaranteed to work if you
properly detached the databases first. But if you are lucky...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases. Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>
|||You can try using sp_attach_db, but if the database wasn't closed properly,
there is no guarantee.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>
|||Copy the LDF and MDF files onto another computer with SQ Lon it and then run
sp_attach_db to attach each DB.
--
Mike Epprecht, Microsoft SQL Server MVP
Johannesburg, South Africa
Mobile: +27-82-552-0268
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>
|||Will it have to be a SQL 7 installation since these came from SQL 7? Or will
it work with SQL 2000 as there are several machines with this installation,
but this may have been the last one remaining with SQL 7 on it
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
> Copy the LDF and MDF files onto another computer with SQ Lon it and then
run[vbcol=seagreen]
> sp_attach_db to attach each DB.
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Johannesburg, South Africa
> Mobile: +27-82-552-0268
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
> news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Backups
outside[vbcol=seagreen]
mounted
>
|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:

> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>
|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>
|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>
|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>
> run
>
> outside
>
> mounted
>
>

Help Crash!

Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
directory with all of the MDF and LDF files in it for the databases. Backups
directory was completely lost and as I understand it there are no outside
copies of backups. How if it is at all possible does one get these mounted
in such a way that they can be recovered in a new machine?Hi,
If you have all the Physical DAT files , including Master database . Then
all you have to do is..
1. Take a copy of all DAT files to a safe location
2. Install SQL 7 in the same folder as old installation
3. apply the same service pack as old
4. stop sql server and SQL Server Agent service
5. Copy all the DAT files to the same folder
6. Start SQl server and SQL Server Agent service.
Now your SQl server will be back as old.
Note:
Now onwards please prepare and backup strategy to backup your databases.
Thanks
Hari
MCDBA
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||Read about sp_attach_db and sp_attach_single_file_db in Books Online. These are only guaranteed to work if you
properly detached the databases first. But if you are lucky...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases. Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||You can try using sp_attach_db, but if the database wasn't closed properly,
there is no guarantee.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||Copy the LDF and MDF files onto another computer with SQ Lon it and then run
sp_attach_db to attach each DB.
--
--
Mike Epprecht, Microsoft SQL Server MVP
Johannesburg, South Africa
Mobile: +27-82-552-0268
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> directory with all of the MDF and LDF files in it for the databases.
Backups
> directory was completely lost and as I understand it there are no outside
> copies of backups. How if it is at all possible does one get these mounted
> in such a way that they can be recovered in a new machine?
>|||Will it have to be a SQL 7 installation since these came from SQL 7? Or will
it work with SQL 2000 as there are several machines with this installation,
but this may have been the last one remaining with SQL 7 on it :)
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
> Copy the LDF and MDF files onto another computer with SQ Lon it and then
run
> sp_attach_db to attach each DB.
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Johannesburg, South Africa
> Mobile: +27-82-552-0268
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
> news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> > Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> > directory with all of the MDF and LDF files in it for the databases.
> Backups
> > directory was completely lost and as I understand it there are no
outside
> > copies of backups. How if it is at all possible does one get these
mounted
> > in such a way that they can be recovered in a new machine?
> >
> >
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it :)
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>>Copy the LDF and MDF files onto another computer with SQ Lon it and then
> run
>>sp_attach_db to attach each DB.
>>--
>>--
>>Mike Epprecht, Microsoft SQL Server MVP
>>Johannesburg, South Africa
>>Mobile: +27-82-552-0268
>>IM: mike@.epprecht.net
>>MVP Program: http://www.microsoft.com/mvp
>>Blog: http://www.msmvps.com/epprecht/
>>"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
>>news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
>>Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
>>directory with all of the MDF and LDF files in it for the databases.
>>Backups
>>directory was completely lost and as I understand it there are no
> outside
>>copies of backups. How if it is at all possible does one get these
> mounted
>>in such a way that they can be recovered in a new machine?
>>
>>
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it :)
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>>Copy the LDF and MDF files onto another computer with SQ Lon it and then
> run
>>sp_attach_db to attach each DB.
>>--
>>--
>>Mike Epprecht, Microsoft SQL Server MVP
>>Johannesburg, South Africa
>>Mobile: +27-82-552-0268
>>IM: mike@.epprecht.net
>>MVP Program: http://www.microsoft.com/mvp
>>Blog: http://www.msmvps.com/epprecht/
>>"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
>>news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
>>Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
>>directory with all of the MDF and LDF files in it for the databases.
>>Backups
>>directory was completely lost and as I understand it there are no
> outside
>>copies of backups. How if it is at all possible does one get these
> mounted
>>in such a way that they can be recovered in a new machine?
>>
>>
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it :)
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>>Copy the LDF and MDF files onto another computer with SQ Lon it and then
> run
>>sp_attach_db to attach each DB.
>>--
>>--
>>Mike Epprecht, Microsoft SQL Server MVP
>>Johannesburg, South Africa
>>Mobile: +27-82-552-0268
>>IM: mike@.epprecht.net
>>MVP Program: http://www.microsoft.com/mvp
>>Blog: http://www.msmvps.com/epprecht/
>>"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
>>news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
>>Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
>>directory with all of the MDF and LDF files in it for the databases.
>>Backups
>>directory was completely lost and as I understand it there are no
> outside
>>copies of backups. How if it is at all possible does one get these
> mounted
>>in such a way that they can be recovered in a new machine?
>>
>>
>|||Hi,
You can also attach a sql 7 db to an sql 2000 server without data loss.
Bradley M. Small wrote:
> Will it have to be a SQL 7 installation since these came from SQL 7? Or will
> it work with SQL 2000 as there are several machines with this installation,
> but this may have been the last one remaining with SQL 7 on it :)
>
> "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
>>Copy the LDF and MDF files onto another computer with SQ Lon it and then
> run
>>sp_attach_db to attach each DB.
>>--
>>--
>>Mike Epprecht, Microsoft SQL Server MVP
>>Johannesburg, South Africa
>>Mobile: +27-82-552-0268
>>IM: mike@.epprecht.net
>>MVP Program: http://www.microsoft.com/mvp
>>Blog: http://www.msmvps.com/epprecht/
>>"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
>>news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
>>Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
>>directory with all of the MDF and LDF files in it for the databases.
>>Backups
>>directory was completely lost and as I understand it there are no
> outside
>>copies of backups. How if it is at all possible does one get these
> mounted
>>in such a way that they can be recovered in a new machine?
>>
>>
>|||Worked without a hitch! Thanks everyone.
"Martin Ha" <martin.ha@.gmx.net> wrote in message
news:410FB18D.10706@.gmx.net...
> Hi,
> You can also attach a sql 7 db to an sql 2000 server without data loss.
> Bradley M. Small wrote:
> > Will it have to be a SQL 7 installation since these came from SQL 7? Or
will
> > it work with SQL 2000 as there are several machines with this
installation,
> > but this may have been the last one remaining with SQL 7 on it :)
> >
> >
> > "Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
> > news:%23IPG20WeEHA.3428@.TK2MSFTNGP11.phx.gbl...
> >
> >>Copy the LDF and MDF files onto another computer with SQ Lon it and then
> >
> > run
> >
> >>sp_attach_db to attach each DB.
> >>
> >>--
> >>--
> >>Mike Epprecht, Microsoft SQL Server MVP
> >>Johannesburg, South Africa
> >>Mobile: +27-82-552-0268
> >>IM: mike@.epprecht.net
> >>
> >>MVP Program: http://www.microsoft.com/mvp
> >>
> >>Blog: http://www.msmvps.com/epprecht/
> >>
> >>"Bradley M. Small" <BSmall@.XNOSPAMXmjsi.com> wrote in message
> >>news:OcvkKvWeEHA.732@.tk2msftngp13.phx.gbl...
> >>
> >>Computer crashed quite severely, was able to recover the C:\MSSQL7\Data
> >>directory with all of the MDF and LDF files in it for the databases.
> >>
> >>Backups
> >>
> >>directory was completely lost and as I understand it there are no
> >
> > outside
> >
> >>copies of backups. How if it is at all possible does one get these
> >
> > mounted
> >
> >>in such a way that they can be recovered in a new machine?
> >>
> >>
> >>
> >>
> >
> >

Monday, March 12, 2012

Help ! Procedure to delete files from operating system

Hi all,

Can anyone help me with a script which would delete files or
move them to a different folder at some scheduled time..!
Please....!!!

Thanks in advance...Raj (rjdave@.indiatimes.com) writes:
> Can anyone help me with a script which would delete files or
> move them to a different folder at some scheduled time..!

Which files? MDF, LDF and NDF files? Or just any random selected files?

In any case, you could use SQL Server Agent to create a CmdExec job for
the task. You can access SQL Server Agent from Enterprise Manager.

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

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

The check for the date in your cursor declaration is probably the cause of
the problem!

Declare mycursor cursor for
select name from #Filenames
where convert(datetime,left(name,10)) <= getdate()-@.duration

Although you can add a style to the convert function, this is not guaranteed
to give the correct results.

From BOL:
style
Is the style of date format used to convert datetime or smalldatetime data
to character data (nchar, nvarchar, char, varchar, nchar, or nvarchar data
types), or the string format when converting float, real, money, or
smallmoney data to character data (nchar, nvarchar, char, varchar, nchar, or
nvarchar data types).

i.e no mention of use of style when converting from character to datetime

A less risky option would be to convert both to strings and then re-arrange
them into an alphabetically comparable format such as YYYYMMDD. Overall I
think the DTS/Filesystemobject may well be the faster and safer solution.

John

"Raj" <rjdave@.indiatimes.com> wrote in message
news:c11c051e.0307120602.4fe8b9c7@.posting.google.c om...
> Erland Sommarskog <sommar@.algonet.se> wrote in message
news:<Xns93B6B78068CAYazorman@.127.0.0.1>...
> > Raj (rjdave@.indiatimes.com) writes:
> > > Can anyone help me with a script which would delete files or
> > > move them to a different folder at some scheduled time..!
> > Which files? MDF, LDF and NDF files? Or just any random selected files?
> > In any case, you could use SQL Server Agent to create a CmdExec job for
> > the task. You can access SQL Server Agent from Enterprise Manager.
> Thanks ...I didn't know about it ... It was great help. But still it
> didn't work . I wanted to run a job and the script is below . I am not
> able to run this script using sql server agent. Can anyone suggest
> whats wrong ...and whats the trick i am missing?
> Create procedure USP_DelOldFiles @.path varchar(25),@.duration int
> as
> --Objective: To delete files older than certain period from a folder
> --Usage example:
> --Exec USP_DelOldFiles 'c:\test',30 -- which deletes files older than
> todaydate-30
> --Created by :MAK
> --Created date: Jan 7,2003
> --OS: windows 2000
> declare @.myquery varchar(1000)
> declare @.query varchar(1000)
> declare @.name varchar(100)
> set @.myquery = "exec master.dbo.xp_cmdshell 'dir "+
> ltrim(rtrim(@.path)) + "\*.* /a/od'"
> print @.query
> create table #Filenames (id int identity(1,1) ,name varchar(100))
> insert #Filenames(name)
> exec (@.Myquery)
> delete from #Filenames where substring(name,3,1) <> '/' or name is
> null or
> substring(name,25,1) ='<'
> Declare mycursor cursor for
> select name from #Filenames where
> convert(datetime,left(name,10)) <= getdate()-@.duration
> open mycursor
> fetch next from mycursor into @.name
> while (@.@.fetch_status =0! )
> begin
> set @.query = 'exec master.dbo.xp_cmdshell "del '+@.path+'\'+
> ltrim(rtrim(substring(@.name,40,59)))+'"'
> --print @.query
> exec (@.query)
> fetch next from mycursor into @.name
> end
> close mycursor
> deallocate mycursor
> drop table #Filenames|||Raj (rjdave@.indiatimes.com) writes:
> Thanks ...I didn't know about it ... It was great help. But still it
> didn't work . I wanted to run a job and the script is below . I am not
> able to run this script using sql server agent. Can anyone suggest
> whats wrong ...and whats the trick i am missing?

Hey, what about *you* tell us what is wrong? I mean, you say that you
are not able to run it, but rather let us guess what you mean with that,
why not specify what you. Do you get an error message? Do the script
end without an files being deleted? Did the script work from Query
Analyzer?

What I can see at a glance is:

> while (@.@.fetch_status =0! )

Syntax error.

> set @.query = 'exec master.dbo.xp_cmdshell "del '+@.path+'\'+
> ltrim(rtrim(substring(@.name,40,59)))+'"'

Should have a /F to force deletion of read-only files.

Really why you make the entire call to xp_cmdshell in dynamic SQL, I
don't know, neither I have cared to check that you get the right statement.
It should be sufficient to have only the DOS command in a variable.

Then again, why SQL at all? Isn't this a symptom of that when all you
have is hammer, everything looks like nails to you. Personally I would
implement this in Perl, but if you VB script or C++, these languages
work equally well for the task. SQL is probably one of more complicated
options you can go for.

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

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

Check out the method in my previous posts, your procedure should work if you
corrected the date formats and typos.
Note the escaped quotes in the command string, rather than using double
quotes.

Create procedure USP_DelOldFiles @.path varchar(25),@.duration int
as
--Objective: To delete files older than certain period from a folder
--Usage example:
--Exec USP_DelOldFiles 'c:\test',30
-- which deletes files older than todaydate-30
--Created by :MAK
--Created date: Jan 7,2003
--OS: windows 2000
declare @.myquery varchar(1000)
declare @.query varchar(1000)
declare @.name varchar(100)
set @.myquery = 'exec master.dbo.xp_cmdshell ''dir '+ ltrim(rtrim(@.path)) +
'\*.* /a/od'''
print @.query

create table #Filenames (id int identity(1,1) ,name varchar(100))

insert #Filenames(name)
exec (@.Myquery)
delete from #Filenames
where substring(name,3,1) <> '/'
or name is null
or substring(name,25,1) ='<'

select name, SUBSTRING(name,7,4) + SUBSTRING(name,4,2) + left(name,2)
from #Filenames

/* Make sure dates are in comparable formats */
Declare mycursor cursor for
select name from #Filenames
where SUBSTRING(name,7,4) + SUBSTRING(name,4,2) + left(name,2) <=
CONVERT(char(8),DATEADD(d,@.duration,getdate()),112 )

open mycursor

fetch next from mycursor into @.name
while @.@.fetch_status = 0
begin
set @.query = 'exec master.dbo.xp_cmdshell ''del '+ @.path + '\'+
ltrim(rtrim(substring(@.name,40,59)))+''''
print @.query
exec (@.query)
fetch next from mycursor into @.name
end
close mycursor
deallocate mycursor

drop table #Filenames

This may also be useful for other things.
http://vyaskn.tripod.com/oracle_sql...equivalents.htm
http://msdn.microsoft.com/library/d...asp?frame=true

John

"Raj" <rjdave@.indiatimes.com> wrote in message
news:c11c051e.0307130220.6fae6dc3@.posting.google.c om...
> Hi ... Sorry but I have to clarify a few things about me first...I am
> a newbie in database administration . I am familiar with many things
> which are Oracle related but for a particular task our company is
> using SQLSERVER 2000. I am lost in this SQL SERVER world . I have only
> one task to be finished with SQLSERVER 2000 . I am slowly making "new
> discoveries" of this database software. Lots of thanks specially to
> YOU Mr.Erland Sommarskog.
> Now the specifics of my task. I want to schedule a job by the
> database software which would delete the files in some folder based on
> the date. The dates of the files would be associated with createddate
> and expirydate columns in a database table i.e., when a file is
> uploaded to a directory then the date info would be inserted in the
> database table column and when the file's reference is deleted in the
> corresponding column a job scheduled to run at some interval of days
> should delete the physical files (*.txt,*.dat..etc) . Hope this make
> something clear for you. Sorry IF I sound stupid but am just earning
> my bread .
> Thanks for the help so far and best wishes.
> Erland Sommarskog <sommar@.algonet.se> wrote in message
news:<Xns93B6F1164E422Yazorman@.127.0.0.1>...
> > Raj (rjdave@.indiatimes.com) writes:
> > > Thanks ...I didn't know about it ... It was great help. But still it
> > > didn't work . I wanted to run a job and the script is below . I am not
> > > able to run this script using sql server agent. Can anyone suggest
> > > whats wrong ...and whats the trick i am missing?
> > Hey, what about *you* tell us what is wrong? I mean, you say that you
> > are not able to run it, but rather let us guess what you mean with that,
> > why not specify what you. Do you get an error message? Do the script
> > end without an files being deleted? Did the script work from Query
> > Analyzer?
> > What I can see at a glance is:
> > > while (@.@.fetch_status =0! )
> > Syntax error.
> > > set @.query = 'exec master.dbo.xp_cmdshell "del '+@.path+'\'+
> > > ltrim(rtrim(substring(@.name,40,59)))+'"'
> > Should have a /F to force deletion of read-only files.
> > Really why you make the entire call to xp_cmdshell in dynamic SQL, I
> > don't know, neither I have cared to check that you get the right
statement.
> > It should be sufficient to have only the DOS command in a variable.
> > Then again, why SQL at all? Isn't this a symptom of that when all you
> > have is hammer, everything looks like nails to you. Personally I would
> > implement this in Perl, but if you VB script or C++, these languages
> > work equally well for the task. SQL is probably one of more complicated
> > options you can go for.|||Raj (rjdave@.indiatimes.com) writes:
> Now the specifics of my task. I want to schedule a job by the
> database software which would delete the files in some folder based on
> the date. The dates of the files would be associated with createddate
> and expirydate columns in a database table i.e., when a file is
> uploaded to a directory then the date info would be inserted in the
> database table column and when the file's reference is deleted in the
> corresponding column a job scheduled to run at some interval of days
> should delete the physical files (*.txt,*.dat..etc) . Hope this make
> something clear for you. Sorry IF I sound stupid but am just earning
> my bread .

Still makes more sense to write a program in VBscript, Perl or
whatever that reads the required information from the database, and
then deletes the files. Running that program could possible be scheduled
from SQL Server Agent.

But running the whole thing from T-SQL with xp_cmdshell is not very
robust, becuase you need handle dateformats that that kind of thing.

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

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

Help ! Lost clients sites

"HELP !! We've lost about 25 client's websites. The databases were backed up along with all the actual files contained within each CSK….in addition, all the original databases are intact & can be reattached to the new SQL server…..the problem that exists where the original CSK files do not recognize the original database once it is reattached to the new SQL server. Any help would be most appreciated.

This is the error……

Login failed for user 'DARRYL1\ASPNET'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: Login failed for user 'DARRYL1\ASPNET'.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException: Login failed for user 'DARRYL1\ASPNET'.]

System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372

System.Data.SqlClient.SqlConnection.Open() +384

System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44

System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38

ASPNET.StarterKit.Communities.CommunityUtility.GetAllCommunitiesFromDB() +93

ASPNET.StarterKit.Communities.CommunityUtility.GetAllCommunities() +58

ASPNET.StarterKit.Communities.CommunityUtility.GetCommunityInfo() +327

ASPNET.StarterKit.Communities.CommunitiesModule.Application_BeginRequest(Object source, EventArgs e) +221

System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87

It looks like you either haven't set up the ASPNET account as a user inSQL Server, or given it permissions on those databases. It's aneasy enough fix though. From Enterprise Manager, under theSecurity node for that SQL Server instance, make sure that the ASPNETaccount is listed as a login, and if not add it. Once it'sadded, on the "Database Access" tab of the properties sheet for thatacocunt, you can give it the appropriate access to each of thosedatabases, and you'll be back up and running.

Friday, March 9, 2012

HELP - SQL Server 2000 Install Files needed urgently

Hi!

I have a large project that is due to complete this week. In order to
complete it I need SQL Server 2000 installed on a remote server. My
disk is corrupt and to order another media disk would damage my
deadline. I have the licence and serial key, but now need good install
files. I am even ready to buy another retail box, if I can find a
supplier that would give me a download site for the media, while I wait
for the shipment!

Please PLEASE help!

Regards,

BarryHi,

Sorry if i'm stating the obvious - but it wasn't commented on in your
post.. If you have the licence and serial key shouldn't you be
contacting Microsoft?

Greg|||Hi Greg. They will send me another media disk, but that doesnt help me
getting it installed for tomorrow.

Thanks for your reply.

Barry|||"TheFoot" <workshop@.carib-sys.com> wrote in message
news:1112918510.565481.327210@.g14g2000cwa.googlegr oups.com...
> Hi Greg. They will send me another media disk, but that doesnt help me
> getting it installed for tomorrow.

Unfortuantely I doubt most anyone here would be comfortable putting binaries
out there to be copied. Even if you're totally legit, MS would have a field
day if they found out.

Sorry.

> Thanks for your reply.
> Barry|||"TheFoot" <workshop@.carib-sys.com> wrote in message
news:1112918510.565481.327210@.g14g2000cwa.googlegr oups.com...
> Hi Greg. They will send me another media disk, but that doesnt help me
> getting it installed for tomorrow.
> Thanks for your reply.

Oh, one other thought.. may be too late by an hour or two, but a couple of
places like PC Connection on the East coast used to have a "order by
midnight and get it the next day" policy. MIGHT have luck with them.

> Barry|||I agree with Greg, nobody's going to "lend" you the SQL Server binaries
based on the premise that you're entitled to them - too much personal
risk.

I see two options:

1. Delay the project and wait for the shipment
2. Incur the extra cost for the "retail box" and hopefully charge it
back to the business|||Download the eval and then upgrade later.

http://www.microsoft.com/sql/evalua...ial/default.asp

--
David Portas
SQL Server MVP
--

Wednesday, March 7, 2012

HELP - problem after copying MDF and Log files

I had a problem where a log file was deleted. I managed to get the database
recovered on my own machine. I sent the MDF and Log files to the client so
he could stop SQL Server, copy the files and then start SQL Server again.
Now I can't get into SQL Server at all - it keeps telling me SQL Server does
not exist or access denied. I tried to delete the files that I copied (after
shutting down SQL Server) but it didn't work - on startup I still can't
access the SQL Server with any of the client tools. HELP!Which database was the log lost for? As long as it was not master or model
you may be able to use sp_attach_single_file_db.
Check if SQL Server is running.
If you did it to master or model, you have messed up the server.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"claire" <claire@.discussions.microsoft.com> wrote in message
news:AE9EC5D3-724A-4480-8367-D85855839152@.microsoft.com...
> I had a problem where a log file was deleted. I managed to get the
database
> recovered on my own machine. I sent the MDF and Log files to the client
so
> he could stop SQL Server, copy the files and then start SQL Server again.
> Now I can't get into SQL Server at all - it keeps telling me SQL Server
does
> not exist or access denied. I tried to delete the files that I copied
(after
> shutting down SQL Server) but it didn't work - on startup I still can't
> access the SQL Server with any of the client tools. HELP!
>|||Stopping the server, copying the files then starting was probably not a good
idea.
If you had the database on your machine then sending a backup and gettig the
client to restore would have been a better option.
Check the sql server logs and application logs - you will probably see a
message to say what has happenned. It sounds like he has corrupted master,
model or done something to change the path of the system databases.
This is probably recoverable but you might be better off re-installing sql
server and attaching all the databases (try ttaching on another server first
to check integrity).
You then might want to look at your backup strategy in case this happens
again.