Home » SQL & PL/SQL » SQL & PL/SQL » Confused need a query (Merged)
Confused need a query (Merged) [message #390297] Thu, 05 March 2009 15:28 Go to next message
boris37
Messages: 1
Registered: March 2009
Location: Canada
Junior Member
So i have to write a query for my work and i'm totally lost using sql server.

Here is what the query is supposed to do:

1) Remove a set bunch of chars from a string(two different rows, same string...)

2) Keep the original string while taking out these original chars.

3) I need an Array and a loop to be able to do it

I am trying write a block but every time i do anything sql server gives me problems saying "didn't expect this here" or something.

Is this even doable in sql server?

I kinda had something like :



DECLARE

CURSOR c1 is ('-','/');

BEGIN
loop




END

in my mind but sql server even gives me issues with the cursor... any tips would be nice but i just need an array i can manually populate. I can run the following query but i have to do it 10-15 times to remove the chars and i want something cleaner(even if it takes me much longer)

UPDATE coalarm set almsentence=replace(almsentence, '-', ' of '),
normsentence=replace(normsentence, '-', ' of ') where almstorenid=23127

**Note** this is only one row hence the "where" clause.

THanks!

Lastly this is my first time using sql server and it's a little different from sqlplus... at least the cryptic errors and fact i can't do anything i could in sqlplus but maybe it's just me.
Re: Confused need a query [message #390300 is a reply to message #390297] Thu, 05 March 2009 15:33 Go to previous message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
You are aware, that this is an Oracle forum, not an SQL Server forum?

Other than that, why do you need an array? Wouldn't a normal SQL only update do the job, too?

[Updated on: Thu, 05 March 2009 15:36]

Report message to a moderator

Previous Topic: Timer
Next Topic: Trouble with trigger
Goto Forum:
  


Current Time: Sat Feb 15 11:32:30 CST 2025