Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sql statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-11-17 : 10:28:56
Michael writes "I'm trying to write a SQL statement that rearranges the data. For example, let's say that the data looks something like this:


firstName
lastName


Michael
Jones


Tammy
>Smith


Shawn
LaGrange

How can I write a simple SQL statement that randomly rearranges the last name to another record? A sample output could look like this:


firstName
lastName


Michael
Smith


Tammy
LaGrange


Shawn
Jones

Originally, record one had "Jones" as the last name, but now it is "Smith". How can I write a SQL statement that performs this function?

I am using SQL Server 2000 on Windows 2003 with the latest service packs."

X002548
Not Just a Number

15586 Posts

Posted - 2006-11-17 : 10:37:37
Maybe you could use SQL Blender....use the ice crush setting



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-17 : 11:19:26
This will match every first name with every last name, have fun.

SELECT a.FirstName, b.LastName
FROM yourtable a
CROSS JOIN yourtable b
Go to Top of Page
   

- Advertisement -