Showing posts with label comma. Show all posts
Showing posts with label comma. Show all posts

Thursday, February 16, 2012

"Find In" Comma Separated Value

Hi,

****SQL Server related question.

I have a table in which one of the columns (col1) holds a string, like: 1,2,3,4,5,6,7,8,9,10

I am passing an int value (@.intValue) to the sproc.

What I want to be able to do is query the table like...


SELECT * FROM myTable where @.intValue ... is in col1

Any ideas?

Thanks a lot!!!!you can do something like

SELECT * FROM myTable WHERE col1 LIKE '%' + convert(varchar,@.intValue) + '%'

hth|||Thanks for the response ndinakar!

I tried your suggestion...

It does work...to a point. However... in my concatenated string, it is a possibility that I will have something that looks like this.

3,4,5,34,6,21

Then, when I query this table...say I am looking for '2' ...it returns the record with 21 in it.

Any other ideas about how I can go about this? I am thinking that I might have to break this concatenated value into separate columns.

Thanks for the reply. I greatly appreciate it!|||same approach, but you need to insure you have leading and trailing seperators

from this:
3,4,5,34,6,21

to this:
,3,4,5,34,6,21,

now you search for %,val,%

or in your example ,2, which wont match ,21,|||Thanks a lot! That works great...exactly what I was looking for.

Friday, January 27, 2012

"," (Comma) as Decimal Place - SQL SERVER 2000 /MSDE2000 does not work

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a
Comma "," instead of a Dot "." Now the problem is SQL Server does not
recognize this and gives error. We can not do collation setting for numeric
fields also.
Any help on the same will be highly appreciated.
Regards
Rajib
SQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>
|||SQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>

"," (Comma) as Decimal Place - SQL SERVER 2000 /MSDE2000 does not work

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a
Comma "," instead of a Dot "." Now the problem is SQL Server does not
recognize this and gives error. We can not do collation setting for numeric
fields also.
Any help on the same will be highly appreciated.
Regards
RajibSQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>

"," (Comma) as Decimal Place - SQL SERVER 2000 /MSDE2000 does not work

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a
Comma "," instead of a Dot "." Now the problem is SQL Server does not
recognize this and gives error. We can not do collation setting for numeric
fields also.
Any help on the same will be highly appreciated.
Regards
RajibSQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>

change the System settings to Swedish(Finland), the decimal space is a Comma

Hi All,
If we change the System settings to Swedish(Finland), the decimal space is a Comma "," instead of a Dot "." Now the problem is SQL Server does not recognize this and gives error. We can not do collation setting for numeric fields also.
Any help on the same will be highly appreciated.
RegardsSQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>
|||SQL Server is not affected by regional settings. You have to give him dots
only.
There is no such thing like "collation setting for numeric fields".
Please read more about collations.
Bojidar Alexandrov
"Rajib Chatterjee" <rajibc@.hotmail.com> wrote in message
news:OpHbNuZXEHA.1888@.TK2MSFTNGP11.phx.gbl...
> Hi All,
> If we change the System settings to Swedish(Finland), the decimal space is
a
> Comma "," instead of a Dot "." Now the problem is SQL Server does not
> recognize this and gives error. We can not do collation setting for
numeric
> fields also.
> Any help on the same will be highly appreciated.
> Regards
> Rajib
>
>