Varchar(25) Update as number (1 Viewer)

Tupacmoche

Registered User.
Local time
Today, 05:24
Joined
Apr 28, 2008
Messages
291
Hi All,

I have a simple update script that inserts a varchar(25) into an empty column. Its type is varchar(25) but the output table displays it in scientific notation which I think would be a number type. In any event here is the script how do, I get it to update as a string of number without the scientific notation?

USE Temp_Upload_Tables
Update tmpEpic_Name SET MRN2 = [Target Patient MRN]
FROM [dbo].MRN as m
inner join tmpEpic_Name as e
on m.[Source Patient MRN] = e.MRN
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:24
Joined
Aug 30, 2003
Messages
36,118
Shot in the dark, but try:

Update tmpEpic_Name SET MRN2 = Cast([Target Patient MRN] As varchar(25))
 

Tupacmoche

Registered User.
Local time
Today, 05:24
Joined
Apr 28, 2008
Messages
291
Just tried it same results:banghead:

USE Temp_Upload_Tables
Update tmpEpic_Name SET MRN2 =Cast([Target Patient MRN] asvarchar(25))
FROM [dbo].MRN as m
inner join tmpEpic_Name as e
on m.[Source Patient MRN] = e.MRN
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:24
Joined
Aug 30, 2003
Messages
36,118
Hmm, and the data type of MRN2 is varchar(25)? I assume there's actually a space after "as".
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:24
Joined
Aug 30, 2003
Messages
36,118
And you're viewing in the table itself, not in a query? If a query, what's the SQL? There could be an implicit conversion going on.
 

Tupacmoche

Registered User.
Local time
Today, 05:24
Joined
Apr 28, 2008
Messages
291
Yes, MRN2 is varchar(25) and yes there is a space. I'm look at the output in a table. It is strange that the value in the source column [Target Patient MRN] is the same data type varchar(25) and it gets formatted this way.:eek:
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:24
Joined
Aug 30, 2003
Messages
36,118
Well, I think I'm stumped. If you want to post the DDL for the tables and some sample data, I'll play with it.
 

Users who are viewing this thread

Top Bottom