Re: sort
From: Steve Kass (skass_at_drew.edu)
Date: 03/07/04
- Next message: Brian: "Re: table structure question"
- Previous message: Louis Davidson: "Re: customize getdate() function"
- In reply to: hmc: "Re: sort"
- Next in thread: Itzik Ben-Gan: "Re: sort"
- Reply: Itzik Ben-Gan: "Re: sort"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 06 Mar 2004 20:03:35 -0500
Here's one solution:
-- generate table with sample data
create table T (
ipAdd varchar(15)
)
insert into T
select
rtrim(abs(binary_checksum(newid()))%256) + '.'
+ rtrim(abs(binary_checksum(newid()))%256) + '.'
+ rtrim(abs(binary_checksum(newid()))%256) + '.'
+ rtrim(abs(binary_checksum(newid()))%256)
from Northwind..Orders
go
-- sort by ipAdd
select ipAdd
from T
order by
0 + parsename(ipAdd,4),
0 + parsename(ipAdd,3),
0 + parsename(ipAdd,2),
0 + parsename(ipAdd,1)
go
drop table T
SK
hmc wrote:
>What if I have a list of IP addresses that's in varchar?
>
>
- Next message: Brian: "Re: table structure question"
- Previous message: Louis Davidson: "Re: customize getdate() function"
- In reply to: hmc: "Re: sort"
- Next in thread: Itzik Ben-Gan: "Re: sort"
- Reply: Itzik Ben-Gan: "Re: sort"
- Messages sorted by: [ date ] [ thread ]