Re: SORT QUERY AND VALUE ASSIGNMENT
From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 05/26/04
- Next message: Jaya kumar.Tanneru: "Executing <filename.sql> file in the VB"
- Previous message: PARADISE HILLS - FLYING HIGH: "SORT QUERY AND VALUE ASSIGNMENT"
- In reply to: PARADISE HILLS - FLYING HIGH: "SORT QUERY AND VALUE ASSIGNMENT"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 26 May 2004 14:13:45 +0530
see following example. it will work in sql server.
--dummy table
create table t(backslashes varchar(50),qtybackslashes int )
--sample records.
insert into t values ('c:\windows',null)
insert into t values ('c:\windows\system',null)
insert into t values ('c:\windows\system\color',null)
--query to get rows in the order of the number of backslashes will be:
select backslashes,
len(backslashes) -len(replace (backslashes, '\','')) as 'no_of_backslashes'
from t
order by 2 desc
--query to update the table with the number of backslashes will be:
update t set qtybackslashes =
len(backslashes) -len(replace (backslashes, '\',''))
-- Vishal Parkar vgparkar@yahoo.co.in | vgparkar@hotmail.com
- Next message: Jaya kumar.Tanneru: "Executing <filename.sql> file in the VB"
- Previous message: PARADISE HILLS - FLYING HIGH: "SORT QUERY AND VALUE ASSIGNMENT"
- In reply to: PARADISE HILLS - FLYING HIGH: "SORT QUERY AND VALUE ASSIGNMENT"
- Messages sorted by: [ date ] [ thread ]