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

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 REPLACE CONVERT QUESTIONS

Author  Topic 

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-12-04 : 16:47:19


my target column is bigint so I would like to convert my SOURCE COLUMN to convert to BIGINT . The below shows that I am removing the RIGHT 11 characters from my source column. example 54124@yahooo.com would be 54124


REPLACE([USER Username], RIGHT([USER Username],10),''),

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-12-04 : 17:32:06
What is your question?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-12-04 : 18:26:01
I posted the question its using convert within replace and right function so I can convert my resulting column from varchar to bigint
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-12-04 : 18:51:27
I'm really not seeing a question. I see statements, but no questions.

Are you saying that the code you posted is NOT doing what you want?

Could you provide more sample data?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-12-04 : 19:46:57
I explained it as much as I can. The replace function I have above is removing the last 11 characters from my source coulm which is varchar . I have to convert that same column to bigint in order to join to another table that's the whole purpose of converting
Go to Top of Page

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-12-04 : 19:48:43
I explained it as much as I can. The replace function I have above is removing the last 11 characters from my source coulm which is varchar . I have to convert that same column to bigint in order to join to another table that's the whole purpose of converting
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-12-04 : 19:50:30
So wrap it in a CONVERT or CAST function.

CAST(your code goes here...as bigint)

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -