Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 update additional note
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

420 Posts

Posted - 11/13/2012 :  21:28:59  Show Profile  Reply with Quote
how can i update email address which is nvarchar(200) to add in additional date and notes?
Example: update to
I tried as below but hit this error 'Conversion failed when converting date and/or time from character string'

DECLARE @email nvarchar(200)
DECLARE @date datetime
SET @userName= ''
SET @date= GETDATE()
Update tableA
set email= @userName+@date
where email= @userName

In (Som, Ni, Yak)

17689 Posts

Posted - 11/13/2012 :  21:47:23  Show Profile  Reply with Quote
SET email= stuff(@userName, charindex('@', @userName), 0, '_NEW' + convert(varchar(10), @date, 112))

Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000