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
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Conversion Fail, Multiple Values
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 03/19/2013 :  09:04:06  Show Profile  Reply with Quote
I am very new to writing views in SQL, so I've quickly run into an problem that I can't figure out.

I needed to convert a field from type varchar to type int so that I could link it to another table in Crystal Reports. Here's my view:

Create view CR_BillingFilterDataINT as

,convert(int,data) as DATA

I found that when the DATA field only contains one value, it works fine. But when DATA has multiple values (example 10, 12, 14) it fails to make the conversion. If I understand it correctly, my view is creating this:

Code / DataType / DATA
1 / 1 / 10,12,14

When I need it to create this:

Code / DataType / DATA
1 / 1 / 10
1 / 1 / 12
1 / 1 / 14

Any help would be appreciated.

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 03/19/2013 :  09:36:33  Show Profile  Visit webfred's Homepage  Reply with Quote
comma separated values in a varchar column is a mess...

you can use the seach field in the upper right corner to get some ideas on how to handle that i.e. splitting the data...

Too old to Rock'n'Roll too young to die.
Go to Top of Page

Starting Member

2 Posts

Posted - 03/19/2013 :  13:46:28  Show Profile  Reply with Quote
I have looked through several posts, found some great information ( and ), and concluded that this will take more than than I can commit at the moment. Thanks anyway :)
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.02 seconds. Powered By: Snitz Forums 2000