Jump to content
Sign in to follow this  
bbenedict

Can someone point out what is wrong with this cast statement?

Recommended Posts

Need to convert some columns to different data type, but this statement will not work. Any idea what I am missing? (mgmt Studio has the first 'CAST' and 'AS' underlined. SELECT CAST [ETL_ID as int] as ETL_ID, NAMEX, DU_DEGREE_STATUS, DU_ESTS_DESC, Cast [bANNER_ID as (varchar(36),Null)]as BANNER_ID, DU_COLLEGE_DESC, cAST [DU_DEL_TERM_CODE_ADMIT as (VARCHAR(255),NULL)] AS DU_DEL_TERM_CODE_ADMIT, AGE, ETHNICITY_DESCRIPTION, GENDER, cAST [T1 as (VARCHAR(255),NULL)] AS T1, T1Status, cAST [T2 as (VARCHAR(255),NULL)] as T2, T2Status, cAST [T3 as (VARCHAR(255),NULL)] as T3, T3Status, cAST [T4 as (VARCHAR(255),NULL)] as T4, T4StatusFROM dbo.['Tracking 3$']

Share this post


Link to post
Share on other sites

Thanks! So i got this to work but there is still one wierd problem, when the cast statement is executed the values in one of the colums goes through this transformation: original (float, null) - 12594570New (after: CAST(thing_ID AS VARCHAR(36)) AS Thing_ID) 1.25946e+007 In the warehouse I cannot link these notations with the fact table.

Share this post


Link to post
Share on other sites

Update: I inserted ,Cast(CAST(BANNER_ID AS VARCHAR(50))as decimal) as BANNER_ID to try and fix the notication and return it back to a simple number and now I get this 'Error converting data type varchar to numeric." so i think i am getting closer.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...