473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Updating Data - A query

First of all I don't normally use SQL, so please excuse my ignorance.

1st Query

We have a table with a column with data that looks like this:
AMTL03256636

What I need to do is change the AMTL portion of the column to another set of
charachters i.e TEST
Currently i'm extracting the data, loading it into excel changing the data
and then bulk inserting it back
into the SQL7 table. Is there away to change the AMTL without the other
steps?

Alan
Jul 20 '05 #1
3 2039
Well TSQL has two functions that would be helpful, REPLACE and SUBSTRING,
basically you search for a matching substring then, if found, replace with
one of your choosing. I have only ever worked with MS SQL Server 7 and 2000
so i don't know whats standard SQL vs. TSQL. Its shame really but thats a
whole nother topic.

</Muhd>

"Alan Payne" <Hiram P Ho*****@bigburp.com> wrote in message
news:XH*****************@news-server.bigpond.net.au...
First of all I don't normally use SQL, so please excuse my ignorance.

1st Query

We have a table with a column with data that looks like this:
AMTL03256636

What I need to do is change the AMTL portion of the column to another set of charachters i.e TEST
Currently i'm extracting the data, loading it into excel changing the data
and then bulk inserting it back
into the SQL7 table. Is there away to change the AMTL without the other
steps?

Alan

Jul 20 '05 #2
Alan Payne (Hiram P Ho*****@bigburp.com) writes:
First of all I don't normally use SQL, so please excuse my ignorance.

1st Query

We have a table with a column with data that looks like this:
AMTL03256636

What I need to do is change the AMTL portion of the column to another
set of charachters i.e TEST Currently i'm extracting the data, loading
it into excel changing the data and then bulk inserting it back into the
SQL7 table. Is there away to change the AMTL without the other steps?


UPDATE tbl
SET col = replace(col, 'AMTL', 'TEST')
WHERE col LIKE 'AMTL%'

Here I am presuming that AMTL is a fixed string, as you gave no further
specification to your problem.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

"Erland Sommarskog" <so****@algonet.se> wrote in message
news:Xn**********************@127.0.0.1...
Alan Payne (Hiram P Ho*****@bigburp.com) writes:
First of all I don't normally use SQL, so please excuse my ignorance.

1st Query

We have a table with a column with data that looks like this:
AMTL03256636

What I need to do is change the AMTL portion of the column to another
set of charachters i.e TEST Currently i'm extracting the data, loading
it into excel changing the data and then bulk inserting it back into the
SQL7 table. Is there away to change the AMTL without the other steps?


UPDATE tbl
SET col = replace(col, 'AMTL', 'TEST')
WHERE col LIKE 'AMTL%'

Here I am presuming that AMTL is a fixed string, as you gave no further
specification to your problem.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Thank you for your assistance, that does the trick exactly.
Alan
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
6
by: Hennie de Nooijer | last post by:
Hi, Currently we're a building a metadatadriven datawarehouse in SQL Server 2000. We're investigating the possibility of the updating tables with enormeous number of updates and insert and the...
1
by: Derek Davlut | last post by:
I have a Table that contains data that I use in a query to manipulte the data through expressions. I have a form that uses the query for manipulating the data. How do I write the changed values...
2
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the...
3
by: Jon Agiato | last post by:
Hi, I am trying to use a data grid in a web application in which I have three tiers. The DataGrid is not set up to a data source, or a data adapter, so everytime I make a change I send the cell...
0
by: Michael Kellogg | last post by:
I have a problem wherein a query that updates a GridView doesn't seem to really stay in sync with a label I have above the GridView. I have a GridView object that I'm updating with information...
4
by: somanyusernamesaretakenal | last post by:
What I am trying to achieve: Basically I have generated a report in access. This report needs to be updated using excel. (Updating the new data, not changing existing data) What I did was I...
0
by: teammcs | last post by:
Hey all, I'm new around here but do Admin over @ PHPHelp.com... I've been developing a project for my degree which is basically based around an ATM machine. Basically my problem is related to...
6
by: OldBirdman | last post by:
I don't really know how to state this problem, as it doesn't make any sense to me. I have a simple "One-to-Many" query, and was updating the Many side. It quit working. I cannot make any changes...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.