SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 MDL & LDF Wrong Date
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

NEDSTER1972
Starting Member

United Kingdom
6 Posts

Posted - 07/03/2013 :  04:42:51  Show Profile  Reply with Quote
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

India
52323 Posts

Posted - 07/03/2013 :  04:51:01  Show Profile  Reply with Quote
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

United Kingdom
6 Posts

Posted - 07/03/2013 :  06:13:32  Show Profile  Reply with Quote
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

India
52323 Posts

Posted - 07/03/2013 :  06:42:39  Show Profile  Reply with Quote
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

United Kingdom
6 Posts

Posted - 07/03/2013 :  06:50:36  Show Profile  Reply with Quote
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

India
52323 Posts

Posted - 07/03/2013 :  06:52:14  Show Profile  Reply with Quote
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

United Kingdom
6 Posts

Posted - 07/03/2013 :  06:57:16  Show Profile  Reply with Quote
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

India
52323 Posts

Posted - 07/03/2013 :  07:03:39  Show Profile  Reply with Quote
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

United Kingdom
6 Posts

Posted - 07/03/2013 :  07:30:55  Show Profile  Reply with Quote
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

India
52323 Posts

Posted - 07/03/2013 :  07:40:14  Show Profile  Reply with Quote
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

United Kingdom
6 Posts

Posted - 07/03/2013 :  07:53:02  Show Profile  Reply with Quote
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

India
52323 Posts

Posted - 07/03/2013 :  08:28:56  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000