Hello, SQL 2008R2
What affect, if any, does having a style when converting from VARCHAR to VARCHAR
I have a dynamic query. The table it reads from changes on a daily basis (I am working to get that changed). Because the table is created from Excel the column types change daily, even though the column names do not. (Why they did not use a template, I do not know). Thus the phone number columns can be either VARCHAR or FLOAT. That is where my conversion code comes in.
If I use the above conversion and it is FLOAT I get what I want, and it seems to work for VARCHAR columns also, but is it okay to use for VARCHAR to VARCHAR?
Thanks
djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
What affect, if any, does having a style when converting from VARCHAR to VARCHAR
Code:
REPLACE(LEFT(CONVERT(varchar(50), PhoneNumber, 2), 11), '.', '')
I have a dynamic query. The table it reads from changes on a daily basis (I am working to get that changed). Because the table is created from Excel the column types change daily, even though the column names do not. (Why they did not use a template, I do not know). Thus the phone number columns can be either VARCHAR or FLOAT. That is where my conversion code comes in.
If I use the above conversion and it is FLOAT I get what I want, and it seems to work for VARCHAR columns also, but is it okay to use for VARCHAR to VARCHAR?
Thanks
djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!