?
Solved

timestamp

Posted on 2006-06-19
2
Medium Priority
?
983 Views
Last Modified: 2008-03-10
I want to preserve the seconds and milliseconds in the timestamp when I assign it to a variable:

select current_timestamp

returns:
2006-06-19 12:00:34.770


Declare @TimeString nvarchar(50)
set @TimeString = (select current_timestamp)

returns:
Jun 19 2006 11:58AM
0
Comment
Question by:dalebrumbaugh
2 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16935855
Declare @TimeString nvarchar(50)
select @TimeString = convert(varchar(30),current_timestamp,120)
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 16935866
Declare @TimeString nvarchar(50)
set @TimeString = CONVERT(varchar,getdate(),121)
SELECT @TimeString
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question