Geeks With Blogs
Pankaj Tahiliani February 2010 Entries
Sql Server Default Date Format - Globalization

To Check the date format of sql server:
select name ,alias, dateformat from syslanguages where langid =(select value from master..sysconfigures where comment = 'default language')

Execute this query on "master" database

You can set the Culture in your web.config file as below:
<system.web>
<globalization culture="en-US" />
</system.web>

Posted On Thursday, February 25, 2010 10:37 PM

Prevent duplicate records using insert query

INSERT INTO hits (recorded_time,ip,ua,request,referer,is_unique)
SELECT Convert(datetime,'2010-02-10 11:00:00'),00001001,'IE','default.aspx','direct',0
WHERE NOT EXISTS (SELECT ID FROM  Hits WHERE IP=00001001);SELECT @@IDENTITY;

Above query will check the existing record of the given IP. If found than it will return the ID else it will insert the new record and than return the newly generated ID.

Posted On Tuesday, February 9, 2010 11:42 PM

Copyright © Pankaj Tahiliani | Powered by: GeeksWithBlogs.net