password99
Technical User
i need to update the date portion (of datetime column) equal to date portion (of datetime column) of another column in the same table. How can i do that using SQL?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[Blue]DECLARE[/Blue] @dt1 [Blue]datetime[/Blue]
[Blue]DECLARE[/Blue] @dt2 [Blue]datetime[/Blue]
[Blue]SET[/Blue] @dt1[Gray]=[/Gray][red]'2004-08-01 8:00'[/red]
[Blue]SET[/Blue] @dt2[Gray]=[/Gray][red]'6/20/2004'[/red]
[Blue]SET[/Blue] @dt1[Gray]=[/Gray]@dt1[Gray]+[/Gray][Fuchsia]DateDiff[/Fuchsia][Gray]([/Gray]dd[Gray],[/Gray]@dt1[Gray],[/Gray]@dt2[Gray])[/Gray]
[Blue]SELECT[/Blue] @dt1