Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2010-07-13 : 07:33:17
|
hi for exaample a person age is 28 how to reperesent it in sql server datetime field... |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-13 : 07:43:24
|
store his birthday: '19820713' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2010-07-13 : 07:44:15
|
any query to do so........ |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-13 : 07:49:01
|
Select convert(datetime,convert(varchar(20),dateadd(yy,-28,getdate()),110))Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-13 : 07:50:23
|
update tableset DayOfBirth = dateadd(yy,-28,getdate())where person=... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-13 : 08:09:01
|
quote: Originally posted by webfred update tableset DayOfBirth = dateadd(yy,-28,getdate())where person=... No, you're never too old to Yak'n'Roll if you're too young to die.
But this will have the time part included.Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-13 : 08:11:27
|
quote: Originally posted by Idera
quote: Originally posted by webfred update tableset DayOfBirth = dateadd(yy,-28,getdate())where person=... No, you're never too old to Yak'n'Roll if you're too young to die.
But this will have the time part included.Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH
You are right  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-13 : 08:12:29
|
(dateadd(yy,-28,dateadd(d,datediff(d,0,getdate()),0))) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|