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 2005 Forums
 Transact-SQL (2005)
 Need a query Help

Author  Topic 

aadilwani
Starting Member

1 Post

Posted - 2010-06-14 : 07:51:34
Hi ,

I have a table containing a column with the Name SiteURL, which contains links of various sites.
eg http://a/b/c
http://c/d/e/f
http://h/r/g
....... and so on

Now i want to write a Sql query which will give me the results in this format

Main Cloumn Cloumn1 Column2 .....

http://a/b/c a b
http://c/d/e/f c d
http://h/r/g h r
Please help.

Sachin.Nand

2937 Posts

Posted - 2010-06-14 : 07:59:40
declare @str varchar(40)='http://a/b/c'
select replace(stuff(@str,1,7,''),'/',' ')


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-06-14 : 08:04:17
Since the path is dynamic, variable, you will need a dynamic crosstab query to solve your problem.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -