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 |
|
cbrinson
Starting Member
36 Posts |
Posted - 2002-01-19 : 19:19:34
|
| Does anyone know which of the following would most likely be faster?Option A.Concatenating a string with fields and passing the formatted string back to asp.SELECT '<a href="javascript:openProfile(' + CONVERT(VARCHAR(6),wr.member_id) + ');">' + wr.nickname + '</a>' AS profile_link ...Option B.Just select the necessary data and pass that back to ASP and have ASP do the string concatenation.SELECT wr.member_id, wr.nickname ...I imagine that the difference in performance is minimal. However, the site receives a good deal of traffic and I would like to optimize it as much as possible. The SQL server is on a separate machine from the web server. On one hand I think the less data you send from the DB Server to the web server the better. But on the other hand I would think that SQL Server might concatenate strings faster than ASP.Thanks,Chris |
|
|
chadmat
The Chadinator
1974 Posts |
Posted - 2002-01-19 : 21:12:41
|
| SQL Server is not optimized for string manipulation. The functions are there, but I believe you would be better off passing the data back to the client and let the client handle the string manipulation.-Chad |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-01-20 : 10:39:26
|
| Another 2¢:I don't disagree with Chad, but I've used embedded HTML in queries like the one you've got and it works very well. It's well suited to situations where you need to embed elaborate HTML around a data value. Links and option elements are especially well-suited for this. If you were simply building an HTML table with the results in it, then you should do that in ASP, using GetString or GetRows, because the HTML is generally simple and symmetrical.The one problem is that if you're using VBScript for your ASP, the string functions aren't all that optimized either. JavaScript would give you better performance, but not resoundingly so. However, you'd almost certainly be stuck with a Do While not rs.EOF ... rs.MoveNext loop to process the code, which is the biggest performance killer in an ASP page.Here's some links on SQL Team that discuss some options, and provide links to other sites with more info:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=10176http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11833http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11019 |
 |
|
|
|
|
|
|
|