|
Home > Archive > Visual FoxPro SQL Queries > January 2006 > REPLACE ALL
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Preacher Man 2006-01-03, 9:24 am |
| What is the SQL equivalent to a REPLACE ALL command in VFP?
I found this in the help section:
SELECT REPLACE('abcdefghicd
e','cde','xxx')
GO
Is this the full syntax and where would I use this command, I tried in the
EM but it doesn't seem to work.
| |
| David Portas 2006-01-03, 9:24 am |
| Preacher Man wrote:
> What is the SQL equivalent to a REPLACE ALL command in VFP?
>
> I found this in the help section:
> SELECT REPLACE('abcdefghicd
e','cde','xxx')
> GO
>
> Is this the full syntax and where would I use this command, I tried in the
> EM but it doesn't seem to work.
REPLACE ALL is basically similar to an UPDATE statement in SQL Server.
That is, both statements are used to update existing rows in a table.
For example:
UPDATE your_table
SET x = 123,
y = 456
WHERE z = 999 ;
You can find the full syntax in SQL Server Books Online.
--
David Portas
SQL Server MVP
--
| |
| Dejan Sarka 2006-01-03, 9:24 am |
| > What is the SQL equivalent to a REPLACE ALL command in VFP?
IIRC Replace in VFP is used to update table records. To update rows in a SQL
table, use the UPDATE statement.
> I found this in the help section:
> SELECT REPLACE('abcdefghicd
e','cde','xxx')
> GO
>
> Is this the full syntax and where would I use this command, I tried in the
> EM but it doesn't seem to work.
You found Replace function, which is not equivalent to VFP Replace command.
--
Dejan Sarka, SQL Server MVP
Mentor
www. SolidQualityLearning
.com
| |
| Preacher Man 2006-01-03, 11:24 am |
| Can the Update command be used in the EM or the QA?
"Dejan Sarka" < dejan_please_reply_t
o_newsgroups.sarka@avtenta.si> wrote in
message news:uBF72cHEGHA.2872@TK2MSFTNGP14.phx.gbl...
>
> IIRC Replace in VFP is used to update table records. To update rows in a
> SQL table, use the UPDATE statement.
>
>
> You found Replace function, which is not equivalent to VFP Replace
> command.
>
> --
> Dejan Sarka, SQL Server MVP
> Mentor
> www. SolidQualityLearning
.com
>
>
| |
| David Portas 2006-01-03, 11:24 am |
| "Preacher Man" <nospam> wrote in message
news:erpibxHEGHA.336@TK2MSFTNGP14.phx.gbl...
> Can the Update command be used in the EM or the QA?
>
I recommend you use Query Analyzer. I think the only way to do it through EM
would be to create a proc containing the UPDATE statement. QA is the better
tool for SQL development.
--
David Portas
SQL Server MVP
--
| |
|
| Yes, it can. I suggest you use QA. And use transactions - i.e. commit the
changes only after you've inspected the results and they are correct.
ML
---
http://milambda.blogspot.com/
| |
| John Smith 2006-01-12, 3:25 am |
| I use the REPLACE function in a UDF, to test an incoming string.
That allows me to test stuff in a SELECT with no UPDATE until after
inspection.
So, if the UDF (user defined function) is named dbo.udfGarbageRemoval, I can
use "inline" SQL to do the preliminary testing and inspection job.
For example:
SELECT udfGarbageRemoval(<fieldname>, <width> ), <field> FROM <table> ORDER
BY <blah>
This gives me immediate results for inspection with no transaction required.
I simply sort ASC and DESC on the field in question, do some Q&A and test
cases, and if the function works, then I do my update as follows:
UPDATE <table>
SET <field> = udfGarbageRemoval(<field>, <width> )
This techique if VERY fast, with no transaction nor update required until
after testing.
Functions are very easy to write in SQL, and blindingly fast.
John Smith
"Preacher Man" <nospam> wrote in message
news:erpibxHEGHA.336@TK2MSFTNGP14.phx.gbl...
> Can the Update command be used in the EM or the QA?
>
> "Dejan Sarka" < dejan_please_reply_t
o_newsgroups.sarka@avtenta.si> wrote in
> message news:uBF72cHEGHA.2872@TK2MSFTNGP14.phx.gbl...
>
>
|
|
|
|
|