SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Adding In HTML Links


Adding In HTML Links

Author
Message
Grey Wilson
Grey Wilson
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 2
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/gwilson/addinginhtmllinks.asp
StrateSQL
StrateSQL
Valued Member
Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)Valued Member (63 reputation)

Group: General Forum Members
Points: 63 Visits: 212
Interesting idea... I would lean towards applying this type of functionality as a business component of an application versus applying it at the database level. I'm also the guy that likes to put logs on the fire in the "Avoid Cursurs" camp.
Aaron Ingold
Aaron Ingold
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1205 Visits: 222
I'd agree, probably best to avoid cursors. (Most) anytime you can offload iterative processing from the database into true recursive techniques using a different tool you're going to be better off.

Also, would it be better to use the REPLACE() function rather than PATINDEX()?
Grey Wilson
Grey Wilson
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 2
Aaron & Jason, thanks for the input.

Aaron, in regards to using the REPLACE() function - I didn't use it in this case, because the field being manipulated is a text, data type field. The REPLACE() function doesn't work on text fields. I generally store most web content in text fields because there is no size limitation.

Jason, I actually like to keep front and Ntier, application coding very generic, and offload complex coding to SQL Server, stored procedures when I can. I do get a lot of criticism for taking that strategy sometimes, but I think it makes life easier for applying application updates. I am a SQL server junkie.

thanks, Grey Wilson
Alastair Browne
Alastair Browne
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 4

Nice idea.

I recently wrote some stored procedures that create hyperlinks, however there was a difference between what I did and what is described in this article.

I had to create hyperlinks to an intranet application, based upon dynamic content of the web page. The data from the database was to be used as an argument to an aspx web page.

Essentially, I used a stored procedure to pull data out of a database and then used .NET to populate the page. I had two choices as to how I displayed certain data fields within hyperlnks...

1. I could get the .NET code behind to do it on the fly. The problem with this was that if the server being linked to changed, someone would have to edit the code behind and re-compile the application. Not desireable as this is a complex application and not written using the normal Visual Studio method (Its written using Unix software development principles if anyone is interested)

2. I could get the stored procedure to output the hyperlinks directly instead of just the data field. This gets round the problem of having to re-compile the application to take account of any changes. The stored procedure is simply amended and re-run in SQL Server. This was beneficial because where I work there is a great deal more SQL server experience than there is Unix-style program development experience.

The way I did this was like this:-

Normal stored procedure snippet...

select mydatafield from mytable

Hyperlink snippet...

select 'http://myserver.net/mypath.aspx?' +

'myarg=' + mydatafield as 'mydatafield'

from mytable

Simple! Isn't it?

Alastair


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search