TIME DataType in SQL2008

SQL Server 2008 introduces a TIME data type which allows us to store the time without the date.

For Example,

DECLARE @t TIME = '17:32:19'
SELECT [Time] = @t


Time
----------------
17:32:19.0000000

The TIME data type also allows you to define the accuracy.  This indicates how many places to the right of the decimal are stored for the seconds portion.

DECLARE @t0 TIME(0) = '17:32:19.1234567',
@t7 TIME(7) = '17:32:19.1234567'
SELECT [Time0] = @t0, [Time7] = @t7


Time0 Time7
-------- ----------------
17:32:19 17:32:19.1234567

You can define from zero to seven places to the right of the decimal.  A TIME(0) takes three bytes to store and a TIME(7) takes five bytes to store.  If you declare a TIME variable without the accuracy it defaults to TIME(7).

TIME will do an implicit conversion from DATETIME and retain only the time portion.  TIME will implicitly accept strings in most common time formats.

DECLARE @d1 DATETIME = '12/19/2007 13:43:23.45',
@t1 TIME(2)
SELECT @t1 = @d1
SELECT TimeOnly = @t1


TimeOnly
-----------
13:43:23.45

Reference:    SQLTeam.com. Check Out New data types in SQL Server 2008

 

Comments

# TIME DataType in SQL2008 « KaushaL.NET

Monday, June 30, 2008 4:21 AM by TIME DataType in SQL2008 « KaushaL.NET

Pingback from  TIME DataType in SQL2008 « KaushaL.NET

# Sephia Catalytic Converter Car Parts Warehouse Kia Spectra, Model Ignition Coil Kia Sephia

Pingback from  Sephia Catalytic Converter Car Parts Warehouse Kia Spectra, Model Ignition Coil Kia Sephia

# Part 2008 Chrysler Pacifica Front Wheel Drive Traction, Blower My Pacifica

Pingback from  Part 2008 Chrysler Pacifica Front Wheel Drive Traction, Blower My Pacifica

# K3500 Lightbulb Chevrolet G3500, K3500 Swap

Friday, May 21, 2010 11:53 PM by K3500 Lightbulb Chevrolet G3500, K3500 Swap

Pingback from  K3500 Lightbulb Chevrolet G3500, K3500 Swap

# V90l 0il, Spoiler V90 Used - 413.ja3ra.com

Sunday, May 23, 2010 4:03 AM by V90l 0il, Spoiler V90 Used - 413.ja3ra.com

Pingback from  V90l 0il, Spoiler V90 Used - 413.ja3ra.com

# 1996 Owners Manual 1999 Chevrolet Lumina, Gm Aftermarket Chevrolet Lumina - 148.defutbolazo.com

Pingback from  1996 Owners Manual 1999 Chevrolet Lumina, Gm Aftermarket Chevrolet Lumina - 148.defutbolazo.com

# 525xi Part Wiper Blade Windshield Washer Brake Booster, Repair Auto Parts Bmw 525xi - 476.renters.ws

Pingback from  525xi Part Wiper Blade Windshield Washer Brake Booster, Repair Auto Parts Bmw 525xi - 476.renters.ws

# Cls550 Promo, Ford E 550 Crew Cab Sell - 350.mfbattle.com

Pingback from  Cls550 Promo, Ford E 550 Crew Cab Sell - 350.mfbattle.com

# 1600 Spare Parts Nissan Datsun, Nissan Aftermarket Performance Parts 240sx S13 - 366.defutbolazo.com

Pingback from  1600 Spare Parts Nissan Datsun, Nissan Aftermarket Performance Parts 240sx S13 - 366.defutbolazo.com

# Volvo S60 Auto Parts Warehouse, Altec Lansing Ahs602i - 447.codebluehacks.org

Pingback from  Volvo S60 Auto Parts Warehouse, Altec Lansing Ahs602i - 447.codebluehacks.org

# Esp Eclipse Custom, C30 Movie Twilight New Moon Eclipse - 217.myipgirl.com

Pingback from  Esp Eclipse Custom, C30 Movie Twilight New Moon Eclipse - 217.myipgirl.com

# 1996 Thunderbird Window Regulator, Used Ford Thunderbird Convertibles - 205.tijuanareader.com

Pingback from  1996 Thunderbird Window Regulator, Used Ford Thunderbird Convertibles - 205.tijuanareader.com

# Used Cars Sale Las Vegas, Chevrolet Vega Troubleshooting - 481.zapstreaming.com

Pingback from  Used Cars Sale Las Vegas, Chevrolet Vega Troubleshooting - 481.zapstreaming.com

# C43 Amg Used M6, Clk550 Aftermarket Chips C43 Amg - 236.akemet.com

Pingback from  C43 Amg Used M6, Clk550 Aftermarket Chips C43 Amg - 236.akemet.com

# Monza Custom Lowest, Monza Used Chevy S10 Search Blazer - 219.akemet.com

Pingback from  Monza Custom Lowest, Monza Used Chevy S10 Search Blazer - 219.akemet.com

# Cherokee Micra Silk Scrub Tops Shirttail Hem Dandy Lion, Part Ignition Coil Nissan Micra Throttle Body - 426.tvshowzone.com

Pingback from  Cherokee Micra Silk Scrub Tops Shirttail Hem Dandy Lion, Part Ignition Coil Nissan Micra Throttle Body - 426.tvshowzone.com

# Replacement Mercedes Benz 280ce Fuel Pump Check Valve, 280ce Shelter - 345.zapstreaming.com

Pingback from  Replacement Mercedes Benz 280ce Fuel Pump Check Valve, 280ce Shelter - 345.zapstreaming.com

# Cressida Sale Garage, Part 1984 Cressida Toyota Cresta - 497.dlmreza.net

Pingback from  Cressida Sale Garage, Part 1984 Cressida Toyota Cresta - 497.dlmreza.net

# Sale Phoenix Rancho Mirage Real Estate, 1997 Mitsubishi Mirage Parts - 53.tvshowzone.com

Pingback from  Sale Phoenix Rancho Mirage Real Estate, 1997 Mitsubishi Mirage Parts - 53.tvshowzone.com

# 1995 - 1983 @ R30 Wholesale Replacement, Sale R30 Source Interlink Media Chevrolet Silverado - 166.tijuanareader.com

Pingback from  1995 - 1983 @ R30 Wholesale Replacement, Sale R30 Source Interlink Media Chevrolet Silverado - 166.tijuanareader.com

# 1987 - 1994 @ Passat Discount Repair, Passat Second Hand New Volkswagen Back - 180.ja3ra.com

Pingback from  1987 - 1994 @ Passat Discount Repair, Passat Second Hand New Volkswagen Back - 180.ja3ra.com

# 2000 - 1996 @ Toy Police Car Videos, 300 D Canon Eos Digital Rebel - 50.animejin.com

Pingback from  2000 - 1996 @ Toy Police Car Videos, 300 D Canon Eos Digital Rebel - 50.animejin.com

# 1989 - 2000 @ Part 1985 Pontiac Parisienne Replacement Mirror, Parisienne Aftermarket Quality Pontiac - 149.animejin.com

Pingback from  1989 - 2000 @ Part 1985 Pontiac Parisienne Replacement Mirror, Parisienne Aftermarket Quality Pontiac - 149.animejin.com

# 1989 - 1980 @ 745li New Used Bmw, Buy 745li Car - 39.computeronlinebingo.com

Pingback from  1989 - 1980 @ 745li New Used Bmw, Buy 745li Car - 39.computeronlinebingo.com

# 2005 - 2002 @ Cabriolet Used Volkswagen Eos, Beretta U22 Neos Canada - 227.unlockiphone30.net

Pingback from  2005 - 2002 @ Cabriolet Used Volkswagen Eos, Beretta U22 Neos Canada - 227.unlockiphone30.net

# 1993 - 1989 @ 2nd Used Ford Ranger Automatic Transmission, Ranger Rzr Parts Doors - 77.dlmreza.net

Pingback from  1993 - 1989 @ 2nd Used Ford Ranger Automatic Transmission, Ranger Rzr Parts Doors - 77.dlmreza.net

# 1991 - 2005 @ Isaiah Berlin Audio, Seat Audi A4 - 304.akemet.com

Pingback from  1991 - 2005 @ Isaiah Berlin Audio, Seat Audi A4 - 304.akemet.com

# 1981 - 1996 @ L300 Third Brake Light 2002 Saturn Sl2, L300 3 Ingredients - 82.tijuanareader.com

Pingback from  1981 - 1996 @ L300 Third Brake Light 2002 Saturn Sl2, L300 3 Ingredients - 82.tijuanareader.com

# 1984 - 2003 @ Gs350 Cooling System Oem, Part Lexus Gs350 2010 Mercedes Benz - 379.jeepsunlimted.com

Pingback from  1984 - 2003 @ Gs350 Cooling System Oem, Part Lexus Gs350 2010 Mercedes Benz - 379.jeepsunlimted.com

# 1993 - 1983 @ Adoption G25 Going, Gmc G25 Replacement Sliding Door Steering Column - 152.an74.com

Pingback from  1993 - 1983 @ Adoption G25 Going, Gmc G25 Replacement Sliding Door Steering Column - 152.an74.com

# 1994 - 1993 @ S550 Part 2008 Mercedes Benz E63 Amg, Amazon S550 Guide - 403.jordanbrandallamerican.com

Pingback from  1994 - 1993 @ S550 Part 2008 Mercedes Benz E63 Amg, Amazon S550 Guide - 403.jordanbrandallamerican.com

# 1997 - 1990 @ 1988 Mercury Sable Accessories Air Filters, Disposable Dinnerware Plastic Cups - 415.unlockiphone30.net

Pingback from  1997 - 1990 @ 1988 Mercury Sable Accessories Air Filters, Disposable Dinnerware Plastic Cups - 415.unlockiphone30.net

# 1994 - 1986 @ Light Odyssey Kft, Chinese Odyssey Srt Fr - 158.an74.com

Pingback from  1994 - 1986 @ Light Odyssey Kft, Chinese Odyssey Srt Fr - 158.an74.com

# 1981 - 1980 @ C15 C1500 Suburban Headlight Video, C1500 Zone Chevrolet Express - 195.codebluehacks.org

Pingback from  1981 - 1980 @ C15 C1500 Suburban Headlight Video, C1500 Zone Chevrolet Express - 195.codebluehacks.org

# 1981 - 2003 @ Big Cadillac Sts Dts Replacement, Dts Prices Specs - 444.jeepsunlimted.com

Pingback from  1981 - 2003 @ Big Cadillac Sts Dts Replacement, Dts Prices Specs - 444.jeepsunlimted.com

# Sunrise: A Song of Two Humans, 1927

Friday, July 02, 2010 7:58 PM by Sunrise: A Song of Two Humans, 1927

Pingback from  Sunrise: A Song of Two Humans, 1927