Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Right Transact isnt working

$
0
0

Hi! good afternoon everyone I've got really stuck with this so I will ask the experts about what's happening!

What I need: 

 I have a column called Business_Area and i want to split in Two separated by the ':'

Business_Area                              |

1 Corporate Services:Compliance |

2 Corporate Services:Compliance |

-------------------------------------------|

My problem is:

When I split the Left Part My code works Perfectly

When i Split the Right Part It didnt respect the ':'

Maybe you will think this is a code problem but my troble is 'THIS CODE works fine with a new table created  and i get the right part correctly' ( sounds crazy)

My code:

Left part:

 select Left(Business_Area,charindex(':',Business_Area)) as [Left]
 from dbo.Standards

Show:

Left                                

1 Corporate Services:

2 Corporate Services:

Exccellent!!!!!! works fine

____________________________________________________________________

Right part:

  select Right(Business_Area,charindex(':',Business_Area)) as [right]
 from dbo.Standards

right

1 Services:Compliance

2 Services:Compliance

Doesnt work with only this table!!! i dont know what is brong

_________________________________________

What i want:

right

1 :Compliance

2 :Compliance

Thanks all for your time!!!!


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>