.net - Check Internet Connectivity from sql query/script....? -
can check availability of internet sql script? google'd lot no use.
any suggestion regarding highly appreciated.
thanks in advance
you can sql clr udf. here example:
[microsoft.sqlserver.server.sqlfunction] public static sqlboolean hasconnectivity(sqlstring url) { try { if (url.isnull) { return false; } var httprequest = (httpwebrequest)httpwebrequest.create(url.tostring()); using(var response = (httpwebresponse)httprequest.getresponse()) { //make sure http repsonse http 200 ok. return response.statuscode == httpstatuscode.ok; } } catch { return false; } }
Comments
Post a Comment