RE: Function writting challange!!
From: Alejandro Mesa (AlejandroMesa_at_discussions.microsoft.com)
Date: 12/06/04
- Next message: Rob: "SQLMail Issue - Not Running"
- Previous message: Patrick: "Function writting challange!!"
- In reply to: Patrick: "Function writting challange!!"
- Next in thread: Louis Davidson: "Re: Function writting challange!!"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 6 Dec 2004 11:51:02 -0800
You can not execute sp_executesql from inside a function (may be there is
back door), but the question here is why a function and not a stored
procedure?
AMB
"Patrick" wrote:
> Hi Freinds,
> SQL 2000
> I need to have this as a function.
>
> -----------------------------
> declare @dr nvarchar(100)
> set @dr = 'c:\compaq\'
>
> create table dirlist (filename varchar(8000))
>
> declare @qq nvarchar(1000)
> set @qq = 'insert into dirlist(filename) exec master..xp_cmdshell ''dir
> '+@dr+''''
> select @qq
> exec sp_executesql @qq
>
>
> delete dirlist where
> substring(filename,1,2) < '00' or
> substring(filename,1,2) > '99' or
> filename is NULL
>
> select * from dirlist
>
>
>
- Next message: Rob: "SQLMail Issue - Not Running"
- Previous message: Patrick: "Function writting challange!!"
- In reply to: Patrick: "Function writting challange!!"
- Next in thread: Louis Davidson: "Re: Function writting challange!!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|