Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

Update query

$
0
0

Hi Mate,

For frequent period of time, i'm doing same process to update a table with consecutive values. Hope to i make this simple an example,

UPDATE   Table_1
   SET   vchar_val = REPLACE (vchar_val, '.360/', '.370/'),
          WHERE   vchar_val LIKE 'http://services%.360/%'
         AND c_version IN ('ALL', 'N/A', '37.0'); 

For 37th version, i'm replacing the places where '36' with '37'. The same i'll do for '38' also...This is making me bore and time consuming process as i've 50 plus records like this for different tables.

So i planned to write a scheduler which i can trigger for each version by giving input as previous version and current version, in which i'll put all this update queries.

Here comes the place where i struck, if i go by giving version values as input, i'm supposed to introduce local parameter to store. HOW CAN I ASSIGN THAT LOCAL VARIABLE TO MY UPDATE SCRIPT.??????

iS IT POSSIBEL WAY::>>vchar_val=Replace(vchar_val, lv1, lv2)

Please suggest me your advices whatever it will be which help me in anyway.

Thanks in advance.

Vino


Viewing all articles
Browse latest Browse all 4729

Trending Articles



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