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 |
|
iminore
Posting Yak Master
141 Posts |
Posted - 2005-01-07 : 11:49:04
|
| Does anyone know of how to check that an url exists? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-07 : 11:54:14
|
| ping it and hope the dns server and everything else in the connection is working ok?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
iminore
Posting Yak Master
141 Posts |
Posted - 2005-01-07 : 11:58:47
|
| and the code (TSQL) for that would be ... |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-07 : 12:04:02
|
| Wouldn't rely on it as it depends on a lot of things - responding ot ping for instance.declare @url varchar(1000)select @url = 'www.mindsdoor.com'declare @sql varchar(2000)select @sql = 'ping ' + @urlcreate table #a(s varchar(1000))insert #aexec master..xp_cmdshell @sqlif exists (select * from #a where s like 'Reply from%') select 'exists'else select 'duff'drop table #a==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-01-07 : 13:02:52
|
| Some sites (like the one I work on) doesn't respond to PING's so that might be an issue.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-01-07 : 22:32:51
|
| I wouldn't try to write code like this in T-SQL ... use the proper tools for the job.- Jeff |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-01-08 : 00:44:30
|
| Hi nr,I executed your query but for all url I get the result 'duff'. Where is the problem?Madhivanan |
 |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2005-01-08 : 01:45:47
|
| means non-english windows. check your ping.exe manually to seewhat is the difference.plus better to rely on "Unknown IP-address" instead of "Reply from". |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-08 : 04:26:40
|
| put in a select * from #a to see what you get back.This won't be reliable though.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|