Showing posts with label serve. Show all posts
Showing posts with label serve. Show all posts

Thursday, March 29, 2012

getting the latest datetime

Hi

I have a DateTime column in my table, and I want to select the first couple of rows whose DateTime values are closest to the currect serve rdatetime. Is there a function like Max() that I can use?

Also, quesion about timestamp. If I create a column of type timestamp, is the value automatically entered by the database on every insert entry to the table?
I have had problems using timestamp so I switched to using datetime now.

Help appreciated!For the first part of your question, I would use the DATEDIFF() function to find the difference between the current date (GETDATE()) and the date value stored in your column, sorted in DESC order, taking the TOP 1 or 2 (however many you want).

The Timestamp data type is actually a unique rowversion containing binary/varbinary data, and its value only has meaning to SQL Server itself. SQL Server updates the value in this column upon every INSERT, UPDATE, and DELETE. You could make use of this Timestamp value for concurrency control, but it does not contain datetime data -- it contains binary/varbinary data.

Terri

Friday, February 24, 2012

Getting Error:Login Failed for user(null) .Reason: Not associated with a trusted SQL Serve

can any one help

Hi,
I have two articles for that
http://harishmvp.blogspot.com/2005/05/you-may-receive-error-login-failed-for.html
http://harishmvp.blogspot.com/2005/05/you-may-receive-error-login-failed-for_25.html
Please check and let me know if this doesnt solve your issue.
Thanks.
|||

Hi,
Thanks for the reply, but i'm getting then following error now. Please suggest some solution at the earliest.
thankyou.

|||if the connection failed that mean the ASPNET user account can not access the DB and the other reason might be the connection string is wrong .... to avoid this .. you know that i normaly do when i test the connection string in new machine
i always use the Northwind or any other built in DB as i know the user ASP will be added to it so i do not confuse ... if you like you can test the ocnnection ot it and then change the DB after succeed
let me know if you need more help as i like solving the connection string problems