How to convert Datetime to only time
select CONVERT(VARCHAR(10), GETDATE(),101)
It will convert the date into varchar in mm/dd/yyyy format.
select CONVERT(VARCHAR(10), GETDATE(),103)
It will convert date in to varchar in dd/mm/yyyy format.
How to convert Datetime in format date and time 00.00.00
select convert(datetime, convert(varchar, getdate(), 101))
How to find Date difference
Use DATEDIFF(d, startdate, endddate) to return the number of day
DATEDIFF(yy, startdate, endddate) to return the number of year
DATEDIFF(m, startdate, endddate) to return the number of months
Convert datetime to String, suppose if u want to compare
select CONVERT(VARCHAR(10), GETDATE(),112)
convert datetime to string in format yyyymmdd,
09/05/2006 = 20060905
02/06/2007 = 20070206
Sleepy sleepy..............
Time to sleep....
Enjoy.....
Any other query regarding this, reply to the post.
Wednesday, May 23, 2007
Some Date time Facts in sql server
Posted by
whocares
at
11:13 PM
0
comments
Thursday, May 17, 2007
How to add the assembly from GAC
1. Go to Visual studio command Prompt
2. type gacutil /l Myassembly
3. Note down the version and Public key token
4. for example version 1.0.0.0 and public key token= 4596487adasfaf
5. now click on the project where u want to add the reference.
In browse give path C:\WINDOWS\assembly\GAC_MSIL\Myassembly\version__Publickey token\myassembly.dll
Replace the version and publickeytoken with ur assembly version.
For example:-
C:\WINDOWS\assembly\GAC_MSIL\Myassembly\1.0.0.0__4596487adasfaf\myassembly.dll
Another doin same
Go TO
1. HKLM/Software/microsoft/fusion
2. Right click in right pane and click new , create new dword value' DisableCacheViewer'(without quotes) and set it value to one.
3. Now go to c: WINDIR/Assembly Folder, search for ur DLL and add reference to it through the Visual studio add reference browse option.
Only one of the methods of how to do it......
It will add the required reference.
Posted by
whocares
at
2:38 PM
0
comments
Tuesday, May 8, 2007
Performance difference between Count(*) vs Count(1)
Both will give the same performance.
Lets consider the scenerio,
Case 1:- Sql server stores internally everything in pages of size 8kb.
So if we using count (1) or the count (*), actually we r dealing with these 8kb(8060 bytes to be precise)
So it doesnot matter if we use count(1) or Count(*), we r dealing with 8kb interal storage of pages.
Case2:-
Suppose we have a index in the table for which we r retreiving count(*) and count(1)
Sub case(A):- Suppose index is on the column which i am using in count.
In this case count(*) and count(1) will both use the same index and perform same.
Sub case(B): Suppose index is not on the column which we r using count(1)
In this case COunt (*) will use the default index but count(1) will not use it.
So count(1) will be slower if index is not on one.
If u like this post reply.
Wishes
whocares
Posted by
whocares
at
11:32 AM
0
comments
Design Mode disabled in Asp.Net
Sometime in Asp.net The Design mode is disabled. So the solution is not to reinstall the .Net or all that stuff , but to Go to Visual studio Command prompt window and write the below command and Press enter.
devenv /resetskippkgs
Enjoy.......
Posted by
whocares
at
11:09 AM
1 comments
Monday, May 7, 2007
How to find The occurence of a particular Column in a database
How to find The occurence of a particular Column in a database
SELET O.Name
FROM sysobjects AS O
JOIN syscolumns AS C
on C.id = O.ID
WHERE C.Name = 'columnName'
sysobjects :To find the tables
syscolumns:-To locate a specific column
Posted by
whocares
at
2:28 PM
2
comments
