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.
| Author |
Topic |
|
davidredden1973
Starting Member
3 Posts |
Posted - 2009-08-21 : 16:37:40
|
| Not sure if this is the correct forum to ask this; but here goes:I know SQL Server doesn't support URL/hyperlinks; but here's my question: I have a table with over 800,000 records and I inseted a column that I want to be able to autopopulate with a url address.Is this possible?for example I have a field within this table called ReportNumberSoif this were excel I would insert a column with this formula autofilled down: =("http://www.someaddress.com/1234/" & ReportNumber) Is there a way to do something similar in SQL Server?I thought it would be under Computed Column Specifications.But that didn't seem to work.David Redden |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-08-21 : 20:26:35
|
| I see three options:1) since the url (minus the reportNumber) is a static string, you can opt to NOT store the value. When you SELECT the data simply return the expression:[url] = 'http://www.someaddress.com/1234/' + convert(varchar, [ReportNumber])2) You can create a "computed column" in the table. alter table add [url] as 'http://www.someaddress.com/1234/' + convert(varchar, [ReportNumber])3) You can update a column in a similar way you use excel:update myTable set [url] = 'http://www.someaddress.com/1234/' + convert(varchar, [ReportNumber])if [reportNumber] is already some type of character then you don't need the convert.I vote for option 1)Be One with the OptimizerTG |
 |
|
|
ScottWhigham
Starting Member
49 Posts |
Posted - 2009-09-03 : 06:18:24
|
| I would opt for option 1 as well although option 2 is more common. Here's what would make this choice for me: "Am I going to have multiple columns (perhaps in other tables) that have this same functionality/desire?" If the answer is yes then I would create a separate table to store the "base" urls and, in my function/view/proc, I would string the result together like TG said in option 1. If the answer is no then I would opt for option 2. I might opt for option 2 anyway - I don't know. Option 3, to me, isn't an option since ReportNumber sounds like an important column and changing it's value seems "wrong".========================================================I have about 1,000 video tutorials on SQL Server 2008, 2005, and 2000 over at http://www.learnitfirst.com/Database-Professionals.aspx |
 |
|
|
|
|
|
|
|