Showing posts with label date. Show all posts
Showing posts with label date. Show all posts

Saturday, February 25, 2012

Clocking Report

Hi,

I have to report the clocking for our company employees. The main clocking table is just employee number & Date/Time clocked. An employee can have any number of clockings per day.

Would it be possible to create a select statement so that there is just 1 row per day for each employee?

[Table Rows]

piet, 2007-02-23 07:59

piet, 2007-02-23 13:01

piet, 2007-02-23 13:55

piet, 2007-02-23 16:35

[Result for SQL statment]

Piet, 2007-02-23, 07:59, 13:01, 13:55, 16:35

Any help will appreciated.

Thanks

Search for Dynamic Pivot and you will find solutions for problems similiar to your post.

Friday, February 10, 2012

clever date to find most recent .bak file

Say I have 3 .bak files named:

jamesB.bak, jamesG.bak, jamesW.bak

Is there a clever way to find out which is the most recent of these
backup files?? Using sql query analyzer preferably...jamesd wrote:

Quote:

Originally Posted by

Say I have 3 .bak files named:
>
jamesB.bak, jamesG.bak, jamesW.bak
>
Is there a clever way to find out which is the most recent of these
backup files?? Using sql query analyzer preferably...


USE msdb;
GO
SELECT * FROM dbo.backupset;

SELECT * FROM dbo.backupfile;
SELECT * FROM dbo.backupfilegroup;
SELECT * FROM dbo.backupmediafamily;
SELECT * FROM dbo.backupmediaset;|||Hi Steve,
I don't think that will work, because I do not have the original msdb
database. I only have 3 .bak files (from another machine) and a virgin
database server (sql 2000).|||"jamesd" <jamesd@.ring4freedom.comwrote in message
news:1160592663.337156.238310@.k70g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

Hi Steve,
I don't think that will work, because I do not have the original msdb
database. I only have 3 .bak files (from another machine) and a virgin
database server (sql 2000).
>


xp_cmdshell with DIR and then read it into a table.|||Please assume that all 3 files have the same ntfs modified date. I am
looking for a way to examine each .bak file to read its metadata and
see which one is most recent.

If I restore each .bak file is there a way to see the date of the
backup?

Greg D. Moore (Strider) wrote:

Quote:

Originally Posted by

"jamesd" <jamesd@.ring4freedom.comwrote in message
news:1160592663.337156.238310@.k70g2000cwa.googlegr oups.com...

Quote:

Originally Posted by

Hi Steve,
I don't think that will work, because I do not have the original msdb
database. I only have 3 .bak files (from another machine) and a virgin
database server (sql 2000).


>
xp_cmdshell with DIR and then read it into a table.