You work as a SQL Server 2012 database administrator at ABC.com. You have developing a
database named WebAnDB that will be used by a web site analysis application. The WebAnDB
database has a table named Visitors that stores date and time data in a column named Accessed.
You must now develop a stored procedure that will insert data into the Accessed column. You
want the stored procedure to store time zone data as well.
How would you accomplish this?
A.
You should make use of a scalar user-defined function.
B.
You should make use of the SET CONTEXT_INFO statement in the stored procedure.
C.
You should make use of the DATETIMEOFFSET data type.
D.
You should make use of the TODATETIMEOFFSET function.
E.
You should make use of the SET FORCEPLAN ON statement in the stored procedure.
F.
You should make use of a cursor.
Explanation:
why not C ?!
DATETIMEOFFSET = TODATETIMEOFFSET ( DATETIME2 , time_zone )
DATETIMEOFFSET is a data type
http://msdn.microsoft.com/en-us/library/bb630289.aspx
TODATETIMEOFFSET is afunction
http://msdn.microsoft.com/en-us/library/bb630335.aspx
DATETIME2 data type doesn’t store offset.
http://msdn.microsoft.com/en-us/library/bb677335.aspx
So, if the [WebAnDB].[Visitors]..[Accessed] needs to store offset I would go with changing the type to prior that DATETIMEOFFSET.
How ever if we are considering changes made by the procedure the TODATETIMEOFFSET would work, unless the [Accessed] data type allows to store the whole information.
Pomimo kryzysu ekonomicznego luksusowe domy cieszą się nadal sporym zainteresowaniem inwestorów. Budowa tego typu domu wiąże się oczywiście z większymi kosztami
http://finansowainteligencja.pl