Tuesday, 15 November 2011

SQL Getdate()



The GetDate() function returns the current system date and time.


Syntax 


  SELECT GetDate() FROM table_name


Notes : Sql Server only Getdate() function used Other Database Used now()


The "Custmast" table


custcode
custname
city
qty
rate
1
Siva
Srivilliputtur
50
70
2
Bala
Sivakasi
30
56
3
Kanna
Madurai
100
200
4
Vijay
Chennai
30
30
5
Kodee
Sandnes
60
80
5
Kodee
Srivilliputtur
60
30

Example :


Select custname,Getdate() as Date from Custmast

custname
Date
Siva
2011-12-05 19:31:29.390
Bala
2011-12-05 19:31:29.390
Kanna
2011-12-05 19:31:29.390
Vijay
2011-12-05 19:31:29.390
Kodee
2011-12-05 19:31:29.390
Kodee
2011-12-05 19:31:29.390

No comments:

Post a Comment


”Back