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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to execute a url in tsql stored procedure

Author  Topic 

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2008-02-29 : 01:46:24
Can i execute a URL in tsql stored procedure.
Waht i want's is to hit a url on some event.
I know i can do it in CLR stored procedure but for that i have to deploy assembly on the server which i want's to avoid.
Is there any way i can hit a url from tsql stored procedure

Kamran Shahid
Sr. Software Engineer(MCSD.Net)
www.netprosys.com

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-29 : 02:40:10
You would you?
The URL is parsed on server side and thus opens your web browser on the server, not your client machine.
This will make it hard for you to read the requested page.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2008-02-29 : 03:13:46
I just want's to hit the url [no response is required]
On the page where i am hitting there is some code which will execute

Kamran Shahid
Sr. Software Engineer(MCSD.Net)
www.netprosys.com
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-29 : 03:16:51
Ok. Use xp_cmdshell stored procedure

exec master..xp_cmd_shell 'www.sqlteam.com'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-29 : 03:20:46
[code]exec master..xp_cmdshell 'c:\progra~1\intern~1\iexplore.exe www.sqlteam.com'[/code]

Change the path to iexplore.exe as per your machine setup.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2008-02-29 : 04:24:03
Thanks all specially Harsh
Harsh Can some how i can get path 'c:\progra~1\intern~1\iexplore.exe'
automatically? [From some function or any thing]


Kamran Shahid
Sr. Software Engineer(MCSD.Net)
www.netprosys.com
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-29 : 05:27:10
[code]DECLARE @Path NVARCHAR(256)

EXEC master..xp_regread 'HKEY_CLASSES_ROOT', 'htmlfile\shell\open\command', NULL, @Path OUTPUT
SELECT @Path = @Path + ' www.sqlteam.com'

select @path
--exec master..xp_cmdshell @Path[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-29 : 05:51:35
quote:
Originally posted by Peso

DECLARE	@Path NVARCHAR(256)

EXEC master..xp_regread 'HKEY_CLASSES_ROOT', 'htmlfile\shell\open\command', NULL, @Path OUTPUT
SELECT @Path = @Path + ' www.sqlteam.com'

select @path
--exec master..xp_cmdshell @Path



E 12°55'05.25"
N 56°04'39.16"



Not sure why it runs for minutes

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-29 : 06:05:43
Me neither. I told OP this is a bad idea.
When copy the @Path content and paste it to Start -> Run, it works.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -