?
Solved

timestamp

Posted on 2006-06-19
2
Medium Priority
?
979 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

800 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