Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 MDL & LDF Wrong Date

Author  Topic 

NEDSTER1972
Starting Member

6 Posts

Posted - 2013-07-03 : 04:42:51
Please help me.
I am using a booking system that uses MDF & LDF databases.
for some reason the booking system has skipped a month forward & it thinks it is August 2013 not July.
so now to load the booking system we have to manually change the computer date to August before it will load up then change the date back once loaded to get to todays date.
It looks like the database has been saved as August is there any way i can get into the database & change it manually back to todays date.
Thank you this is my first post & i am computer literate but not sql or mdf or ldf.
Please help

I am new please don't shout at me

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-03 : 04:51:01
you can. just do an update on database table to set date fields to GETDATE() function to get todays value.

Also if you just have mdf and ldf files you need to first attach them to a server to make your db online and then do the update i suggested above.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

NEDSTER1972
Starting Member

6 Posts

Posted - 2013-07-03 : 06:13:32
Thank you for reply but as i say i am new to this.
I am using sql 2008 i can open sql server managment studio & i can see my sql server & i get system databases etc how do i change dates on these what tab or function do i use. sorry for my ignorance

I am new please don't shout at me
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-03 : 06:42:39
ok...My first question
Can you see the database where you want update to happen when you open sql server managment studio? or do you've just have files mdf and ldf sent to you by someone?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

NEDSTER1972
Starting Member

6 Posts

Posted - 2013-07-03 : 06:50:36
yes i get in the object explorer:
my computer sql server
i expand that & get:
+databases
+security
+server objects
+replication
+managment
+sql server agent
I open these fields & get many more tabs .
thank you for your help

I am new please don't shout at me
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-03 : 06:52:14
Nope...not the answer i expected.
I was asking can you see the database where you want to do the update when you expand databases node above?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

NEDSTER1972
Starting Member

6 Posts

Posted - 2013-07-03 : 06:57:16
Sorry mate
yes i can expand them & i see my booking system database.
cheers


I am new please don't shout at me
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-03 : 07:03:39
quote:
Originally posted by NEDSTER1972

Sorry mate
yes i can expand them & i see my booking system database.
cheers


I am new please don't shout at me


Ok. then its easy

click on new query button on top menu (on left end). It will open up a new window
type this query


USE [your databasename here]
GO

UPDATE YourTableNameHere
SET YourDateField = GETDATE()


replace the part in blue with actual values

then click execute button (with icon !) and data wll get updated

now check it like this by typing below query in new window


SELECT COUNT(*),
COUNT(CASE WHEN DATEDIFF(dd,0,YourDateField) >= DATEDIFF(dd,0,GETDATE()) THEN 1 ELSE NULL END)
FROM YourTableNameHere



and you should get same value for both the count fields

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

NEDSTER1972
Starting Member

6 Posts

Posted - 2013-07-03 : 07:30:55
Again Thank you mate.
But i think this is just to much for me there are so many fields in database i dont know what to choose.
your time & effort are much appreciated

I am new please don't shout at me
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-03 : 07:40:14
Sorry I dont think I (or anybody else online) would be able to help you more. As we cant see or access your system unless you give us information on column names atleast we cant give excat solution

Also you may please take out that signature of yours. Its a little irritating to see that statement over and over again. Dont worry nobody will shout at you. After all, we all have started as a complete noob just like you

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

NEDSTER1972
Starting Member

6 Posts

Posted - 2013-07-03 : 07:53:02
I understand.
I have tried to talk people through computer stuff i the past & it is hard to do if you dont have the system in front of you.
The booking system we are using is gladstone mrm plus 2 & there are hundreds of fields & columns to know which needs changing.
the signature was just i have joined other forums in the past & they are not as understanding as you are.

Thank You
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-03 : 08:28:56
ok...you can just identify those columns and then use my query replacing them for code in blue

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -