Showing posts with label stored. Show all posts
Showing posts with label stored. Show all posts

Friday, March 30, 2012

How to create sproc with unlimited number of parameters?

We have this kind of thing in C#, and I know the sp_executesql (or something like that) does it too. How do you create a stored procedure that has certain known parameters, followed by any number of additional parameters?

For example, you may have one that's called in any of these ways:

exec my_sp @.ID, @.text, @.P1, @.P2

exec my_sp @.ID, @.text, @.P1, @.P2, @.P3

exec my_sp @.ID, @.text, @.P4, @.P39087, @.P2

I can't find a syntax in the docs that really accommodates this.

Thanks in advance for your help!

Is something like this what you are looking for? This defines a procedure with M required parameters and N optional parameters:

create procedure dbo.xample
( @.pm_required_01 <type#01>,
@.pm_required_02 <type#02>,
...
@.pm_required_M <type#M>,
@.pm_optional_01 <type#01> = <defaultValue#01>,
@.pm_optional_02 <type#02> = <defaultValue#02>,
...
@.pm_optional_N <Type#N> = <defaultValue#N>
)
as

yourCode

|||Does this solution enforce a maximum number of parameters though? If so, that's not quite what I was after.

I guess the other problem too is that there has to be some way to iterate through all of the parameters as well.|||

Jeff:

It sounds to me like you want to use a "list" as an argument to the stored procedure; if that is the case examine this article by Erland Sommarskog and see if this is the correct orientation:

http://www.sommarskog.se/arrays-in-sql.html

Also, there is a response here from Jens Suessmeyer that has some more about using a "string list":

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=326300&SiteID=1

|||

TSQL has a hard limit of ~2K Parameters to any module. Thus, there is no way to do what your asking natively in TSQL (i.e, the best you can do is 2K sql_variant parameters with a default defined ).

People have used various techniques to get around this problem, most of which are nicely summarized in the links above.

How to Create Read Only Stored Procedre!

Hi,
does anyone know how to create "READ ONLY" Soted Procedure Like System
Stored Proc.
Thanks
DishanThere is nothing like the syatem stored procedures whch makes them "read only". Can you expand on
what you want to do?
You can create the proc in master and name it sp_... This will mean that you can access it from
every db without qualifying the database name. Is this what you want?
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Dishan" <d700693@.hotmail.com> wrote in message news:OhjXbRtZDHA.1748@.TK2MSFTNGP12.phx.gbl...
> Hi,
> does anyone know how to create "READ ONLY" Soted Procedure Like System
> Stored Proc.
> Thanks
> Dishan
>|||No no..,
Say if I want to Encrypt Some stored procedure .Then WE Use Encryption
key word as
CREATE PROCEDURE mysp
WITH ENCRYPTION
AS ...
if we want to Create stored procedure READ ONLY. (Read only means when u
click it on Enterprise Manager . The stored procedure cant be edited!)
How can I do It? any key word LIKE..
CREATE PROCEDURE mysp
WITH READ ONLY
AS ...
"Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
wrote in message news:OrjQ0KuZDHA.2136@.TK2MSFTNGP10.phx.gbl...
> There is nothing like the syatem stored procedures whch makes them "read
only". Can you expand on
> what you want to do?
> You can create the proc in master and name it sp_... This will mean that
you can access it from
> every db without qualifying the database name. Is this what you want?
> --
> Tibor Karaszi, SQL Server MVP
> Archive at: http://groups.google.com/groups?oi=djq&as
ugroup=microsoft.public.sqlserver
>
> "Dishan" <d700693@.hotmail.com> wrote in message
news:OhjXbRtZDHA.1748@.TK2MSFTNGP12.phx.gbl...
> > Hi,
> > does anyone know how to create "READ ONLY" Soted Procedure Like
System
> > Stored Proc.
> >
> > Thanks
> > Dishan
> >
> >
>|||There is no such thing as a read only stored procedure in SQL Server. EM will not allow you to
"edit" the system stored procedures, but that is only an EM thing so you don't mess up SQL Server.
AFAIK, EM check whether a stored procedure is a system stored procedure. Use the recommendation as
posted in some other post to mark the proc as a system proc if you really want to do this, but that
is not documented - not supported.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Dishan" <d700693@.hotmail.com> wrote in message news:OvspJN5ZDHA.2932@.tk2msftngp13.phx.gbl...
> No no..,
> Say if I want to Encrypt Some stored procedure .Then WE Use Encryption
> key word as
> CREATE PROCEDURE mysp
> WITH ENCRYPTION
> AS ...
> if we want to Create stored procedure READ ONLY. (Read only means when u
> click it on Enterprise Manager . The stored procedure cant be edited!)
> How can I do It? any key word LIKE..
> CREATE PROCEDURE mysp
> WITH READ ONLY
> AS ...
>
> "Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
> wrote in message news:OrjQ0KuZDHA.2136@.TK2MSFTNGP10.phx.gbl...
> > There is nothing like the syatem stored procedures whch makes them "read
> only". Can you expand on
> > what you want to do?
> > You can create the proc in master and name it sp_... This will mean that
> you can access it from
> > every db without qualifying the database name. Is this what you want?
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > Archive at: http://groups.google.com/groups?oi=djq&as
> ugroup=microsoft.public.sqlserver
> >
> >
> > "Dishan" <d700693@.hotmail.com> wrote in message
> news:OhjXbRtZDHA.1748@.TK2MSFTNGP12.phx.gbl...
> > > Hi,
> > > does anyone know how to create "READ ONLY" Soted Procedure Like
> System
> > > Stored Proc.
> > >
> > > Thanks
> > > Dishan
> > >
> > >
> >
> >
>

Wednesday, March 28, 2012

How to create objects under dbo without DDL admin rights??

Does someone have any suggestions on what rights to grant a user to allow
them to only create stored procedures, functions under dbo without granting
DDL admin?Hi,
Open Database properties and the under permissions you can set for user to
create and alter objects.
Danijel Novak
"John Barr" <JohnBarr@.discussions.microsoft.com> wrote in message
news:344873E1-75CC-441F-A9FF-B63ECF38E7A9@.microsoft.com...
> Does someone have any suggestions on what rights to grant a user to allow
> them to only create stored procedures, functions under dbo without
> granting
> DDL admin?|||That I know, but I want a user to be able to create a new procedure, but
create it as dbo.procedure. As far as I know, you cannot do this without DDL
Admin rights.
"Danijel Novak" wrote:

> Hi,
> Open Database properties and the under permissions you can set for user to
> create and alter objects.
> --
> Danijel Novak
>
> "John Barr" <JohnBarr@.discussions.microsoft.com> wrote in message
> news:344873E1-75CC-441F-A9FF-B63ECF38E7A9@.microsoft.com...
>
>|||In SQL 2000 and earlier versions, the user must be either:
- a db_ddladmin role member
- a db_owner role member
- the database owner
- a sysadmin role member
Of course, membership in these role provides considerably more permissions
as well.
Note that the ability to create dbo-owned procs and functions essentially
allows users to retrieve and manipulate data in all dbo-owned tables. This
is one reason why one typically allows only DBAs to create dbo-owned
objects.
Hope this helps.
Dan Guzman
SQL Server MVP
"John Barr" <JohnBarr@.discussions.microsoft.com> wrote in message
news:344873E1-75CC-441F-A9FF-B63ECF38E7A9@.microsoft.com...
> Does someone have any suggestions on what rights to grant a user to allow
> them to only create stored procedures, functions under dbo without
> granting
> DDL admin?|||Hi,
true said by Dan , that's why ! we only do it with only
- a db_ddladmin role member
- a db_owner role member
- the database owner
- a sysadmin role member , so in shore please don't permit it to not dbo
user.
:-)
Regards
--
Andy Davis
Activecrypt Team
---
SQL Server Encryption Software
http://www.activecrypt.com
"Dan Guzman" wrote:

> In SQL 2000 and earlier versions, the user must be either:
> - a db_ddladmin role member
> - a db_owner role member
> - the database owner
> - a sysadmin role member
> Of course, membership in these role provides considerably more permissions
> as well.
> Note that the ability to create dbo-owned procs and functions essentially
> allows users to retrieve and manipulate data in all dbo-owned tables. Thi
s
> is one reason why one typically allows only DBAs to create dbo-owned
> objects.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "John Barr" <JohnBarr@.discussions.microsoft.com> wrote in message
> news:344873E1-75CC-441F-A9FF-B63ECF38E7A9@.microsoft.com...
>
>

Friday, March 23, 2012

How to Create CLR Based Stored Procedures

I need to create CLR Based Stored Procedures using VS2005 Standard Edition in Sql Server 2005 Standard Edition. Unfortunately, when I create a new project in VS2005. I can not find the template to create a Sql server project using C#. I re-install sql server and Vs2005, the problem still there. Does Vs2005 standard edition support create sql server project? Thanks a lot.

O sure it does, its located under File --> New --> Project --> Visual C# --> Database --> SQL Server Project.

If its not located in there you have to reinstall the Visual Studio template from the setup file.


HTH, Jens Suessmeyer.


http://www.sqlserver2005.de

how to create an stored procedure to an existan database?

i already hava an database in the MSDE database server, but now i want to add some stored procedures to that specifi database in the MSDE database server, how can i do that?You can use Enterprise Manager from SQL Server, and if you have the correct edition, you can use Visual Studio.NET.|||is there any other way?? like can i use comand prompt to create stored procedures?i want that way, and I have MSDE.|||I did reply to yourother post, and now that I see what you want to do, I also recommend this link:Administering SQL Server Using osql. There are further links at the bottom which should help you with what you are trying to do.

Terri|||thanks very much
that helps me a lot.sql

Wednesday, March 21, 2012

How to create a table (structure) based on a result of a stored procedure

Dear all,
There is a stored procedure that returns a result set consisting of some 30
columns of different types.
How can I automatically (i.e. not by means of CREATE TABLE statement) create
a table with a structure that correspons to the returned result set?
I mean something like:
SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
(The above unfortunately doesn't work).
To be specific: the stored procedure in question is:
sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
Any help would be greatly appreciated!
Thank you in advance.
Best regards,
AndrewAndrew
> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
No , you have to know how many "columns" stored procedures will be returned
insert into tablename exec sp
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
> Dear all,
> There is a stored procedure that returns a result set consisting of some
> 30
> columns of different types.
> How can I automatically (i.e. not by means of CREATE TABLE statement)
> create
> a table with a structure that correspons to the returned result set?
> I mean something like:
> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
> To be specific: the stored procedure in question is:
> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
> Any help would be greatly appreciated!
> Thank you in advance.
> Best regards,
> Andrew
>|||following statement will not work ..SELECT * INTO #xxx FROM (EXECUTE
sp_storedprocedure)
instead of select you can use INSERT INTO will work
eg:
create table #t(i int)
insert into #t exec myproc
create proc myproc
as
select 1
vinu
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
> Dear all,
> There is a stored procedure that returns a result set consisting of some
> 30
> columns of different types.
> How can I automatically (i.e. not by means of CREATE TABLE statement)
> create
> a table with a structure that correspons to the returned result set?
> I mean something like:
> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
> To be specific: the stored procedure in question is:
> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
> Any help would be greatly appreciated!
> Thank you in advance.
> Best regards,
> Andrew
>|||Dear Uri,
As I wrote, the idea is to create the table automatically, i.e. NOT to use
the CREATE TABLE statement.
Best regards,
Andrew
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
> Andrew
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
> No , you have to know how many "columns" stored procedures will be
> returned
> insert into tablename exec sp
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>> Dear all,
>> There is a stored procedure that returns a result set consisting of some
>> 30
>> columns of different types.
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> I mean something like:
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> To be specific: the stored procedure in question is:
>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>> Any help would be greatly appreciated!
>> Thank you in advance.
>> Best regards,
>> Andrew
>>
>|||As I wrote, the idea is to create the table automatically, i.e. NOT to use
the CREATE TABLE statement.
Best regards,
Andrew
"vt" <vinu.t.1976@.gmail.com> wrote in message
news:%23GSuhRyAHHA.4672@.TK2MSFTNGP02.phx.gbl...
> following statement will not work ..SELECT * INTO #xxx FROM (EXECUTE
> sp_storedprocedure)
> instead of select you can use INSERT INTO will work
> eg:
> create table #t(i int)
> insert into #t exec myproc
>
> create proc myproc
> as
> select 1
>
> vinu
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>> Dear all,
>> There is a stored procedure that returns a result set consisting of some
>> 30
>> columns of different types.
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> I mean something like:
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> To be specific: the stored procedure in question is:
>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>> Any help would be greatly appreciated!
>> Thank you in advance.
>> Best regards,
>> Andrew
>>
>|||Andrew
Well, in that case take a look into dynamic sql
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
> Dear Uri,
> As I wrote, the idea is to create the table automatically, i.e. NOT to use
> the CREATE TABLE statement.
> Best regards,
> Andrew
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>> Andrew
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> No , you have to know how many "columns" stored procedures will be
>> returned
>> insert into tablename exec sp
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>> Dear all,
>> There is a stored procedure that returns a result set consisting of some
>> 30
>> columns of different types.
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> I mean something like:
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> To be specific: the stored procedure in question is:
>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>> Any help would be greatly appreciated!
>> Thank you in advance.
>> Best regards,
>> Andrew
>>
>>
>|||Dear Uri,
Thank you for the hint. If I understand you correctly, you suggest that I
should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
That's OK, but how can I get (programmatically) the list of "columns" that
are returned by the stored procedure?
My basic question is
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
So, the situation is as follows: I have got a stored procedure and want to
put its result set into a new table.
Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
but instead of ExistingTableOrView there is a stored procedure.
Best regards,
Andrew
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
> Andrew
> Well, in that case take a look into dynamic sql
>
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
>> Dear Uri,
>> As I wrote, the idea is to create the table automatically, i.e. NOT to
>> use the CREATE TABLE statement.
>> Best regards,
>> Andrew
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>> Andrew
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> No , you have to know how many "columns" stored procedures will be
>> returned
>> insert into tablename exec sp
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>> Dear all,
>> There is a stored procedure that returns a result set consisting of
>> some 30
>> columns of different types.
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> I mean something like:
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> To be specific: the stored procedure in question is:
>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>> Any help would be greatly appreciated!
>> Thank you in advance.
>> Best regards,
>> Andrew
>>
>>
>>
>|||Andrew
--This procedure returns three or two columns from Orders Table depends on
parameter
create proc usp_test
@.orderid int =10248
as
if @.orderid=10248
select orderid,orderdate from orders where orderid=@.orderid
else
select orderid,orderdate,CustomerID from orders where orderid=@.orderid
--I use OPENROWSET command to run this SP and get the data out to temporary
table
select * into #t
from
openrowset('SQLOLEDB','SERVER=NT_SQL_4;DATABASE=Northwind;UID=appdev;PWD=np,jho;',
'set fmtonly off; exec usp_test 10249') as p
select * from #t
drop table #t
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
> Dear Uri,
> Thank you for the hint. If I understand you correctly, you suggest that I
> should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
> That's OK, but how can I get (programmatically) the list of "columns" that
> are returned by the stored procedure?
> My basic question is
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
> So, the situation is as follows: I have got a stored procedure and want to
> put its result set into a new table.
> Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
> but instead of ExistingTableOrView there is a stored procedure.
> Best regards,
> Andrew
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> Well, in that case take a look into dynamic sql
>>
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
>> Dear Uri,
>> As I wrote, the idea is to create the table automatically, i.e. NOT to
>> use the CREATE TABLE statement.
>> Best regards,
>> Andrew
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>> Andrew
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> No , you have to know how many "columns" stored procedures will be
>> returned
>> insert into tablename exec sp
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>> Dear all,
>> There is a stored procedure that returns a result set consisting of
>> some 30
>> columns of different types.
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> I mean something like:
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> To be specific: the stored procedure in question is:
>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>> Any help would be greatly appreciated!
>> Thank you in advance.
>> Best regards,
>> Andrew
>>
>>
>>
>>
>
>|||Well .. it is not possible to use select into...exec
vt
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:OXdJJayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
> As I wrote, the idea is to create the table automatically, i.e. NOT to use
> the CREATE TABLE statement.
> Best regards,
> Andrew
>
> "vt" <vinu.t.1976@.gmail.com> wrote in message
> news:%23GSuhRyAHHA.4672@.TK2MSFTNGP02.phx.gbl...
>> following statement will not work ..SELECT * INTO #xxx FROM (EXECUTE
>> sp_storedprocedure)
>> instead of select you can use INSERT INTO will work
>> eg:
>> create table #t(i int)
>> insert into #t exec myproc
>>
>> create proc myproc
>> as
>> select 1
>>
>> vinu
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>> Dear all,
>> There is a stored procedure that returns a result set consisting of some
>> 30
>> columns of different types.
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> I mean something like:
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> To be specific: the stored procedure in question is:
>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>> Any help would be greatly appreciated!
>> Thank you in advance.
>> Best regards,
>> Andrew
>>
>>
>|||Dear Uri,
Great! It works!
Thank you very much for your help!
Best regards,
Andrew
P.S. Isn't it a bit strange that we have to refer to our own SQL server via
'openrowset'?
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OboMuXzAHHA.5060@.TK2MSFTNGP02.phx.gbl...
> Andrew
> --This procedure returns three or two columns from Orders Table depends
> on parameter
> create proc usp_test
> @.orderid int =10248
> as
> if @.orderid=10248
> select orderid,orderdate from orders where orderid=@.orderid
> else
> select orderid,orderdate,CustomerID from orders where orderid=@.orderid
> --I use OPENROWSET command to run this SP and get the data out to
> temporary table
> select * into #t
> from
> openrowset('SQLOLEDB','SERVER=NT_SQL_4;DATABASE=Northwind;UID=appdev;PWD=np,jho;',
> 'set fmtonly off; exec usp_test 10249') as p
> select * from #t
> drop table #t
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
>> Dear Uri,
>> Thank you for the hint. If I understand you correctly, you suggest that
>> I
>> should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
>> That's OK, but how can I get (programmatically) the list of "columns"
>> that
>> are returned by the stored procedure?
>> My basic question is
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> So, the situation is as follows: I have got a stored procedure and want
>> to
>> put its result set into a new table.
>> Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
>> but instead of ExistingTableOrView there is a stored procedure.
>> Best regards,
>> Andrew
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> Well, in that case take a look into dynamic sql
>>
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
>> Dear Uri,
>> As I wrote, the idea is to create the table automatically, i.e. NOT to
>> use the CREATE TABLE statement.
>> Best regards,
>> Andrew
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>> Andrew
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> No , you have to know how many "columns" stored procedures will be
>> returned
>> insert into tablename exec sp
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>> Dear all,
>> There is a stored procedure that returns a result set consisting of
>> some 30
>> columns of different types.
>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>> create
>> a table with a structure that correspons to the returned result set?
>> I mean something like:
>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>> (The above unfortunately doesn't work).
>> To be specific: the stored procedure in question is:
>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>> Any help would be greatly appreciated!
>> Thank you in advance.
>> Best regards,
>> Andrew
>>
>>
>>
>>
>>
>>
>|||> P.S. Isn't it a bit strange that we have to refer to our own SQL server
> via
> 'openrowset'?
:-)
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ezPsolzAHHA.3540@.TK2MSFTNGP03.phx.gbl...
> Dear Uri,
> Great! It works!
> Thank you very much for your help!
> Best regards,
> Andrew
> P.S. Isn't it a bit strange that we have to refer to our own SQL server
> via
> 'openrowset'?
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OboMuXzAHHA.5060@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> --This procedure returns three or two columns from Orders Table depends
>> on parameter
>> create proc usp_test
>> @.orderid int =10248
>> as
>> if @.orderid=10248
>> select orderid,orderdate from orders where orderid=@.orderid
>> else
>> select orderid,orderdate,CustomerID from orders where orderid=@.orderid
>> --I use OPENROWSET command to run this SP and get the data out to
>> temporary table
>> select * into #t
>> from
>> openrowset('SQLOLEDB','SERVER=NT_SQL_4;DATABASE=Northwind;UID=appdev;PWD=np,jho;',
>> 'set fmtonly off; exec usp_test 10249') as p
>> select * from #t
>> drop table #t
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
>> Dear Uri,
>> Thank you for the hint. If I understand you correctly, you suggest that
>> I
>> should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
>> That's OK, but how can I get (programmatically) the list of "columns"
>> that
>> are returned by the stored procedure?
>> My basic question is
>>> How can I automatically (i.e. not by means of CREATE TABLE
>>> statement)
>>> create
>>> a table with a structure that correspons to the returned result set?
>> So, the situation is as follows: I have got a stored procedure and want
>> to
>> put its result set into a new table.
>> Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
>> but instead of ExistingTableOrView there is a stored procedure.
>> Best regards,
>> Andrew
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> Well, in that case take a look into dynamic sql
>>
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
>> Dear Uri,
>> As I wrote, the idea is to create the table automatically, i.e. NOT to
>> use the CREATE TABLE statement.
>> Best regards,
>> Andrew
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>> Andrew
>>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>>> (The above unfortunately doesn't work).
>> No , you have to know how many "columns" stored procedures will be
>> returned
>> insert into tablename exec sp
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>>> Dear all,
>>>
>>> There is a stored procedure that returns a result set consisting of
>>> some 30
>>> columns of different types.
>>> How can I automatically (i.e. not by means of CREATE TABLE
>>> statement)
>>> create
>>> a table with a structure that correspons to the returned result set?
>>>
>>> I mean something like:
>>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>>> (The above unfortunately doesn't work).
>>>
>>> To be specific: the stored procedure in question is:
>>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>>>
>>> Any help would be greatly appreciated!
>>> Thank you in advance.
>>>
>>> Best regards,
>>> Andrew
>>>
>>>
>>
>>
>>
>>
>>
>>
>
>|||> P.S. Isn't it a bit strange that we have to refer to our own SQL server via
> 'openrowset'?
OPENQUERY() is another option...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ezPsolzAHHA.3540@.TK2MSFTNGP03.phx.gbl...
> Dear Uri,
> Great! It works!
> Thank you very much for your help!
> Best regards,
> Andrew
> P.S. Isn't it a bit strange that we have to refer to our own SQL server via
> 'openrowset'?
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OboMuXzAHHA.5060@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> --This procedure returns three or two columns from Orders Table depends
>> on parameter
>> create proc usp_test
>> @.orderid int =10248
>> as
>> if @.orderid=10248
>> select orderid,orderdate from orders where orderid=@.orderid
>> else
>> select orderid,orderdate,CustomerID from orders where orderid=@.orderid
>> --I use OPENROWSET command to run this SP and get the data out to
>> temporary table
>> select * into #t
>> from
>> openrowset('SQLOLEDB','SERVER=NT_SQL_4;DATABASE=Northwind;UID=appdev;PWD=np,jho;',
>> 'set fmtonly off; exec usp_test 10249') as p
>> select * from #t
>> drop table #t
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
>> Dear Uri,
>> Thank you for the hint. If I understand you correctly, you suggest that
>> I
>> should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
>> That's OK, but how can I get (programmatically) the list of "columns"
>> that
>> are returned by the stored procedure?
>> My basic question is
>>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>>> create
>>> a table with a structure that correspons to the returned result set?
>> So, the situation is as follows: I have got a stored procedure and want
>> to
>> put its result set into a new table.
>> Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
>> but instead of ExistingTableOrView there is a stored procedure.
>> Best regards,
>> Andrew
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> Well, in that case take a look into dynamic sql
>>
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
>> Dear Uri,
>> As I wrote, the idea is to create the table automatically, i.e. NOT to
>> use the CREATE TABLE statement.
>> Best regards,
>> Andrew
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>> Andrew
>>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>>> (The above unfortunately doesn't work).
>> No , you have to know how many "columns" stored procedures will be
>> returned
>> insert into tablename exec sp
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>>> Dear all,
>>>
>>> There is a stored procedure that returns a result set consisting of
>>> some 30
>>> columns of different types.
>>> How can I automatically (i.e. not by means of CREATE TABLE statement)
>>> create
>>> a table with a structure that correspons to the returned result set?
>>>
>>> I mean something like:
>>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>>> (The above unfortunately doesn't work).
>>>
>>> To be specific: the stored procedure in question is:
>>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>>>
>>> Any help would be greatly appreciated!
>>> Thank you in advance.
>>>
>>> Best regards,
>>> Andrew
>>>
>>>
>>
>>
>>
>>
>>
>>
>
>|||Tibor
I did not want to create a linked server that OPENQUERY required unlike
OPENROWSET when you can reference to the server without having a linked
server
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OfQkCm0AHHA.1224@.TK2MSFTNGP04.phx.gbl...
>> P.S. Isn't it a bit strange that we have to refer to our own SQL server
>> via
>> 'openrowset'?
> OPENQUERY() is another option...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:ezPsolzAHHA.3540@.TK2MSFTNGP03.phx.gbl...
>> Dear Uri,
>> Great! It works!
>> Thank you very much for your help!
>> Best regards,
>> Andrew
>> P.S. Isn't it a bit strange that we have to refer to our own SQL server
>> via
>> 'openrowset'?
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:OboMuXzAHHA.5060@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> --This procedure returns three or two columns from Orders Table
>> depends
>> on parameter
>> create proc usp_test
>> @.orderid int =10248
>> as
>> if @.orderid=10248
>> select orderid,orderdate from orders where orderid=@.orderid
>> else
>> select orderid,orderdate,CustomerID from orders where orderid=@.orderid
>> --I use OPENROWSET command to run this SP and get the data out to
>> temporary table
>> select * into #t
>> from
>> openrowset('SQLOLEDB','SERVER=NT_SQL_4;DATABASE=Northwind;UID=appdev;PWD=np,jho;',
>> 'set fmtonly off; exec usp_test 10249') as p
>> select * from #t
>> drop table #t
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
>> Dear Uri,
>> Thank you for the hint. If I understand you correctly, you suggest
>> that
>> I
>> should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
>> That's OK, but how can I get (programmatically) the list of "columns"
>> that
>> are returned by the stored procedure?
>> My basic question is
>>> How can I automatically (i.e. not by means of CREATE TABLE
>>> statement)
>>> create
>>> a table with a structure that correspons to the returned result
>>> set?
>> So, the situation is as follows: I have got a stored procedure and want
>> to
>> put its result set into a new table.
>> Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
>> but instead of ExistingTableOrView there is a stored procedure.
>> Best regards,
>> Andrew
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
>> Andrew
>> Well, in that case take a look into dynamic sql
>>
>>
>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>> news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
>> Dear Uri,
>> As I wrote, the idea is to create the table automatically, i.e. NOT
>> to
>> use the CREATE TABLE statement.
>> Best regards,
>> Andrew
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>>> Andrew
>>>
>>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>>> (The above unfortunately doesn't work).
>>>
>>> No , you have to know how many "columns" stored procedures will be
>>> returned
>>>
>>> insert into tablename exec sp
>>>
>>>
>>> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
>>> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>>> Dear all,
>>>
>>> There is a stored procedure that returns a result set consisting of
>>> some 30
>>> columns of different types.
>>> How can I automatically (i.e. not by means of CREATE TABLE
>>> statement)
>>> create
>>> a table with a structure that correspons to the returned result
>>> set?
>>>
>>> I mean something like:
>>> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
>>> (The above unfortunately doesn't work).
>>>
>>> To be specific: the stored procedure in question is:
>>> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
>>>
>>> Any help would be greatly appreciated!
>>> Thank you in advance.
>>>
>>> Best regards,
>>> Andrew
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>

How to create a table (structure) based on a result of a stored procedure

following statement will not work ..SELECT * INTO #xxx FROM (EXECUTE
sp_storedprocedure)
instead of select you can use INSERT INTO will work
eg:
create table #t(i int)
insert into #t exec myproc
create proc myproc
as
select 1
vinu
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
> Dear all,
> There is a stored procedure that returns a result set consisting of some
> 30
> columns of different types.
> How can I automatically (i.e. not by means of CREATE TABLE statement)
> create
> a table with a structure that correspons to the returned result set?
> I mean something like:
> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
> To be specific: the stored procedure in question is:
> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
> Any help would be greatly appreciated!
> Thank you in advance.
> Best regards,
> Andrew
>
Well .. it is not possible to use select into...exec
vt
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:OXdJJayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
> As I wrote, the idea is to create the table automatically, i.e. NOT to use
> the CREATE TABLE statement.
> Best regards,
> Andrew
>
> "vt" <vinu.t.1976@.gmail.com> wrote in message
> news:%23GSuhRyAHHA.4672@.TK2MSFTNGP02.phx.gbl...
>
sql

How to create a table (structure) based on a result of a stored procedure

Andrew

> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
No , you have to know how many "columns" stored procedures will be returned
insert into tablename exec sp
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
> Dear all,
> There is a stored procedure that returns a result set consisting of some
> 30
> columns of different types.
> How can I automatically (i.e. not by means of CREATE TABLE statement)
> create
> a table with a structure that correspons to the returned result set?
> I mean something like:
> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
> To be specific: the stored procedure in question is:
> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
> Any help would be greatly appreciated!
> Thank you in advance.
> Best regards,
> Andrew
>
Andrew
Well, in that case take a look into dynamic sql
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
> Dear Uri,
> As I wrote, the idea is to create the table automatically, i.e. NOT to use
> the CREATE TABLE statement.
> Best regards,
> Andrew
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>
|||Andrew
--This procedure returns three or two columns from Orders Table depends on
parameter
create proc usp_test
@.orderid int =10248
as
if @.orderid=10248
select orderid,orderdate from orders where orderid=@.orderid
else
select orderid,orderdate,CustomerID from orders where orderid=@.orderid
--I use OPENROWSET command to run this SP and get the data out to temporary
table
select * into #t
from
openrowset('SQLOLEDB','SERVER=NT_SQL_4;DATABASE=No rthwind;UID=appdev;PWD=np,jho;',
'set fmtonly off; exec usp_test 10249') as p
select * from #t
drop table #t
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
> Dear Uri,
> Thank you for the hint. If I understand you correctly, you suggest that I
> should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
> That's OK, but how can I get (programmatically) the list of "columns" that
> are returned by the stored procedure?
> My basic question is
> So, the situation is as follows: I have got a stored procedure and want to
> put its result set into a new table.
> Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
> but instead of ExistingTableOrView there is a stored procedure.
> Best regards,
> Andrew
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
>
>
|||> P.S. Isn't it a bit strange that we have to refer to our own SQL server
> via
> 'openrowset'?
:-)
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ezPsolzAHHA.3540@.TK2MSFTNGP03.phx.gbl...
> Dear Uri,
> Great! It works!
> Thank you very much for your help!
> Best regards,
> Andrew
> P.S. Isn't it a bit strange that we have to refer to our own SQL server
> via
> 'openrowset'?
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OboMuXzAHHA.5060@.TK2MSFTNGP02.phx.gbl...
>
>
|||Tibor
I did not want to create a linked server that OPENQUERY required unlike
OPENROWSET when you can reference to the server without having a linked
server
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OfQkCm0AHHA.1224@.TK2MSFTNGP04.phx.gbl...
> OPENQUERY() is another option...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:ezPsolzAHHA.3540@.TK2MSFTNGP03.phx.gbl...
>

How to create a table (structure) based on a result of a stored procedure

Dear all,
There is a stored procedure that returns a result set consisting of some 30
columns of different types.
How can I automatically (i.e. not by means of CREATE TABLE statement) create
a table with a structure that correspons to the returned result set?
I mean something like:
SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
(The above unfortunately doesn't work).
To be specific: the stored procedure in question is:
sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
Any help would be greatly appreciated!
Thank you in advance.
Best regards,
AndrewAndrew

> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
No , you have to know how many "columns" stored procedures will be returned
insert into tablename exec sp
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
> Dear all,
> There is a stored procedure that returns a result set consisting of some
> 30
> columns of different types.
> How can I automatically (i.e. not by means of CREATE TABLE statement)
> create
> a table with a structure that correspons to the returned result set?
> I mean something like:
> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
> To be specific: the stored procedure in question is:
> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
> Any help would be greatly appreciated!
> Thank you in advance.
> Best regards,
> Andrew
>|||following statement will not work ..SELECT * INTO #xxx FROM (EXECUTE
sp_storedprocedure)
instead of select you can use INSERT INTO will work
eg:
create table #t(i int)
insert into #t exec myproc
create proc myproc
as
select 1
vinu
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
> Dear all,
> There is a stored procedure that returns a result set consisting of some
> 30
> columns of different types.
> How can I automatically (i.e. not by means of CREATE TABLE statement)
> create
> a table with a structure that correspons to the returned result set?
> I mean something like:
> SELECT * INTO #xxx FROM (EXECUTE sp_storedprocedure)
> (The above unfortunately doesn't work).
> To be specific: the stored procedure in question is:
> sp_MSenum_replication_agents @.type = 4, @.exclude_anonymous = 1
> Any help would be greatly appreciated!
> Thank you in advance.
> Best regards,
> Andrew
>|||As I wrote, the idea is to create the table automatically, i.e. NOT to use
the CREATE TABLE statement.
Best regards,
Andrew
"vt" <vinu.t.1976@.gmail.com> wrote in message
news:%23GSuhRyAHHA.4672@.TK2MSFTNGP02.phx.gbl...
> following statement will not work ..SELECT * INTO #xxx FROM (EXECUTE
> sp_storedprocedure)
> instead of select you can use INSERT INTO will work
> eg:
> create table #t(i int)
> insert into #t exec myproc
>
> create proc myproc
> as
> select 1
>
> vinu
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>|||Dear Uri,
As I wrote, the idea is to create the table automatically, i.e. NOT to use
the CREATE TABLE statement.
Best regards,
Andrew
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
> Andrew
>
> No , you have to know how many "columns" stored procedures will be
> returned
> insert into tablename exec sp
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:ueWGWKyAHHA.1012@.TK2MSFTNGP04.phx.gbl...
>|||Andrew
Well, in that case take a look into dynamic sql
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
> Dear Uri,
> As I wrote, the idea is to create the table automatically, i.e. NOT to use
> the CREATE TABLE statement.
> Best regards,
> Andrew
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:esBsGPyAHHA.3536@.TK2MSFTNGP03.phx.gbl...
>|||Dear Uri,
Thank you for the hint. If I understand you correctly, you suggest that I
should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
That's OK, but how can I get (programmatically) the list of "columns" that
are returned by the stored procedure?
My basic question is
So, the situation is as follows: I have got a stored procedure and want to
put its result set into a new table.
Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
but instead of ExistingTableOrView there is a stored procedure.
Best regards,
Andrew
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...[vbcol=seagreen]
> Andrew
> Well, in that case take a look into dynamic sql
>
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:u7PBTayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
>|||Andrew
--This procedure returns three or two columns from Orders Table depends on
parameter
create proc usp_test
@.orderid int =10248
as
if @.orderid=10248
select orderid,orderdate from orders where orderid=@.orderid
else
select orderid,orderdate,CustomerID from orders where orderid=@.orderid
--I use OPENROWSET command to run this SP and get the data out to temporary
table
select * into #t
from
openrowset('SQLOLEDB','SERVER=NT_SQL_4;D
ATABASE=Northwind;UID=appdev;PWD=np,
jho;',
'set fmtonly off; exec usp_test 10249') as p
select * from #t
drop table #t
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
> Dear Uri,
> Thank you for the hint. If I understand you correctly, you suggest that I
> should CREATE TABLE dynamically (EXEC ('CREATE TABLE...')).
> That's OK, but how can I get (programmatically) the list of "columns" that
> are returned by the stored procedure?
> My basic question is
> So, the situation is as follows: I have got a stored procedure and want to
> put its result set into a new table.
> Something like SELECT * INTO MyNewTable FROM ExistingTableOrView,
> but instead of ExistingTableOrView there is a stored procedure.
> Best regards,
> Andrew
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%23N7N5hyAHHA.5068@.TK2MSFTNGP02.phx.gbl...
>
>|||Well .. it is not possible to use select into...exec
vt
"Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
news:OXdJJayAHHA.4328@.TK2MSFTNGP03.phx.gbl...
> As I wrote, the idea is to create the table automatically, i.e. NOT to use
> the CREATE TABLE statement.
> Best regards,
> Andrew
>
> "vt" <vinu.t.1976@.gmail.com> wrote in message
> news:%23GSuhRyAHHA.4672@.TK2MSFTNGP02.phx.gbl...
>|||Dear Uri,
Great! It works!
Thank you very much for your help!
Best regards,
Andrew
P.S. Isn't it a bit strange that we have to refer to our own SQL server via
'openrowset'?
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OboMuXzAHHA.5060@.TK2MSFTNGP02.phx.gbl...
> Andrew
> --This procedure returns three or two columns from Orders Table depends
> on parameter
> create proc usp_test
> @.orderid int =10248
> as
> if @.orderid=10248
> select orderid,orderdate from orders where orderid=@.orderid
> else
> select orderid,orderdate,CustomerID from orders where orderid=@.orderid
> --I use OPENROWSET command to run this SP and get the data out to
> temporary table
> select * into #t
> from
> openrowset('SQLOLEDB','SERVER=NT_SQL_4;D
ATABASE=Northwind;UID=appdev;PWD=n
p,jho;',
> 'set fmtonly off; exec usp_test 10249') as p
> select * from #t
> drop table #t
>
> "Andrew Drake" <andrewdrake@.hotmail.com> wrote in message
> news:OzpHB2yAHHA.1220@.TK2MSFTNGP04.phx.gbl...
>

How to create a stored procedure to query the data mining model?

How to create a stored procedure to query the data mining model?

Where can I find some sample code?

Thanks.

Joe.

Details on how to create a stored procedure can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/SQLDMPrgrm.asp whitetaper

In the "Extending the Functionality of SQL Server Data Mining" section there are multiple examples of stored procedures. One of them, ExecuteContentQuery, shows exactly how to execute a (content) query over a mining model. The content query can be replaced with any other DMX query returning flattened results

Hope this helps

|||Thanks Bogdan

How to create a stored procedure to query the data mining model?

How to create a stored procedure to query the data mining model?

Where can I find some sample code?

Thanks.

Joe.

Details on how to create a stored procedure can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/SQLDMPrgrm.asp whitetaper

In the "Extending the Functionality of SQL Server Data Mining" section there are multiple examples of stored procedures. One of them, ExecuteContentQuery, shows exactly how to execute a (content) query over a mining model. The content query can be replaced with any other DMX query returning flattened results

Hope this helps

|||Thanks Bogdan

How to create a stored procedure of this code (inline sql in aspx) ?

I have some SQL code as inline SQL (bad habit, I know). Now I want to convert this to an sproc, but I'm pretty much out of ideas here. The code looks like this:

string

SQL ="SELECT * FROM MyDBTable WHERE 1=1";if (txtMyField1.Text !="")

{

SQL = SQL +

" AND MyField1 = @.MyField";

}

if (txtMyField2.Text !="")

{

SQL = SQL +

" AND MyField2 LIKE '%'+ @.MyField2 + '%'";

}

if (txtMyField3.Text !="")

{

SQL = SQL +

" AND MyField3 LIKE '%' + @.MyField3 + '%'";

}

I have an search page built on ASP.NET 2.0. Based on what the user has entered to the form fields, the SQL in constructed on the fly. Since this is now inside codebehind file (aspx.cs), I want to get rid of it and move it to an sproc. But the question is how ? Some simple SQL clauses are easy to convert to an sproc but this is causing me lots of issues.

You may try this see if it is working or not:

CREATE PROCEDURE dbo.sp_Test (
@.MyField varchar(5) = null,
@.MyField2 varchar(5)= null,
@.MyField3 varchar(5)= null
)
AS

Begin
declare @.Syntax varchar(500)

SELECT @.Syntax = 'SELECT * FROM MyDBTable' +
'WHERE 1=1' +
CASE
WHEN @.MyField IS NOT NULL and @.MyField <> ''
THEN ' AND MyField1 = ''' + @.MyField + ''''
ELSE ''
END +
CASE
WHEN @.MyField2 IS NOT NULL and @.MyField2 <> ''
THEN ' AND MyField2 LIKE ''%'+ @.MyField2 + '%'''
ELSE ''
END +
CASE
WHEN @.MyField3 IS NOT NULL and @.MyField3 <> ''
THEN ' AND MyField3 LIKE ''%'+ @.MyField3 + '%'''
ELSE ''
END

EXECUTE(@.syntax)
End

You need adjust the size of the variables as request.

|||Thanks for the code. I'll try this later and let you know how it worked.|||Thanks JimmyM for your assistance, it worked !!! However you had an typo in your reply, since FROM was there twice. But this wasn't an issue.|||Sorry for the typo, glad that the solution is working for you.sql

Monday, March 19, 2012

How to create a second independent transaction inside a CLR stored procedure?

I use the context connection for the "normal" work in the CLR procedure.
But I need to commit some data in every case. So I need to create a second transaction which is independent from the calling transaction.

What is the best way to do this inside a CLR procedure?

Thanx a lot

Hi!

Create another connection to the server and create a transaction on this second connection. Please note that since your main connection is inproc (“context connection=true” in the connection string), the second connection should be non-inproc (network. Of cause, you can connect to the same server.).

|||Thank you,

I tried this already. But I got an error when I call BeginTransaction on the second connection. When I remember correctly it as "Transcation already in use by another session". I call the procedure from t-sql inside a begin tran block

Any idea about that?

I will try to build a small example an post it here.|||

Hello,
I made a small example to reproduce the error.

CLR procedure
<Microsoft.SqlServer.Server.SqlProcedure()> _

Public Shared Sub Test(ByVal sConnectString As String)

Dim t As SqlClient.SqlTransaction = Nothing

Dim c As SqlClient.SqlConnection = Nothing

c = New SqlClient.SqlConnection(sConnectString)

c.Open()

t = c.BeginTransaction()

t.Commit()

c.Close()

End Sub

T-SQL caller:
begin tran
execute Test 'Server=(local);database=cpwerx;user Id=sa;password=xyz'
commit tran

Error:
A .NET Framework error occurred during execution of user defined routine or aggregate 'Cas':
System.Data.SqlClient.SqlException: Transaction context in use by another session.
System.Data.SqlClient.SqlException:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.PropagateTransactionCookie(Byte[] cookie)
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)
at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction)
at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()

|||

Hi!

Modify your connection string so that it has "Enlist=false" in it. Otherwise the connection inherits current transaction.

More on "Enlist" option is in doc on SqlConnection.ConnectionString property

How To Create a PDF from a stored procedure

I am trying to write a stored procedure that generates a PDF file for example my PDF file will look something like this (there should be spaces between the columns):

First Name Last Name Address
Mike Mik Jr 141552 South
Charlie D 1422141

Lets say my table name whichthat has all these data is called dbo.TestTable
I spent so much time in google and I have not found one simple good example. Can you help me please

Thanks in advance for your help

Hi,

You can refer this link: http://www.sqlservercentral.com/columnists/mivica/creatingapdffromastoredprocedure.asp

I guess it solves your problem.

Thanks & Regards,

Kiran.Y

|||

Thank you for your replay. I' ve seen this article before but it did not really help. Exmple1 and 2 in the article are straight forward but you can’t see how to output the PDF file. Also it does not show you how to loop through the pdf table. I did run the stored procedure under The link SQL2PDF.TXT but it did not generate the PDF File.

Thank you

How To Create a PDF from a stored procedure

I am trying to write a stored procedure that generates a PDF file for example my PDF file will look something like this (there should be spaces between the columns):

First Name Last Name Address
Mike Mik Jr 141552 South
Charlie D 1422141

Lets say my table name whichthat has all these data is called dbo.TestTable
I spent so much time in google and I have not found one simple good example. Can you help me please

Thanks in advance for your help

Hi,

You can refer this link: http://www.sqlservercentral.com/columnists/mivica/creatingapdffromastoredprocedure.asp

I guess it solves your problem.

Thanks & Regards,

Kiran.Y

|||

Thank you for your replay. I' ve seen this article before but it did not really help. Exmple1 and 2 in the article are straight forward but you can’t see how to output the PDF file. Also it does not show you how to loop through the pdf table. I did run the stored procedure under The link SQL2PDF.TXT but it did not generate the PDF File.

Thank you

How To Create a PDF from a stored procedure

I am trying to write a stored procedure that generates a PDF file for example my PDF file will look something like this (there should be spaces between the columns):

First Name Last Name Address
Mike Mik Jr 141552 South
Charlie D 1422141

Lets say my table name which has all these data is called dbo.TestTable.
I would like my stored procedure to output a PDF file with data from TestTable.
I spent so much time in google and I have not found one simple good example. Can you help me please

Thanks in advance for your help

Quote:

Originally Posted by goal2007

I am trying to write a stored procedure that generates a PDF file for example my PDF file will look something like this (there should be spaces between the columns):

First Name Last Name Address
Mike Mik Jr 141552 South
Charlie D 1422141

Lets say my table name which has all these data is called dbo.TestTable.
I would like my stored procedure to output a PDF file with data from TestTable.
I spent so much time in google and I have not found one simple good example. Can you help me please

Thanks in advance for your help


There's no way a stored procedure can directly output its results to a PDF file that I know of. I suggest that you make a .NET component that creates a database connection, executes your stored procedure retrieving a dataset, creates a PDF file and writes the output to it. You can leverage a free iTextSharp library http://itextsharp.sourceforge.net/ for making PDF files. It provides for basic formatting and may be just what you need. Then, you have a few options of setting up your component to run either as a SQL job or Windows service or even invoke it from inside the stored procedure itself (requires CLR integration). Hope this is helpful. Let me know if you need more details.|||

Quote:

Originally Posted by davef

There's no way a stored procedure can directly output its results to a PDF file that I know of. I suggest that you make a .NET component that creates a database connection, executes your stored procedure retrieving a dataset, creates a PDF file and writes the output to it. You can leverage a free iTextSharp library http://itextsharp.sourceforge.net/ for making PDF files. It provides for basic formatting and may be just what you need. Then, you have a few options of setting up your component to run either as a SQL job or Windows service or even invoke it from inside the stored procedure itself (requires CLR integration). Hope this is helpful. Let me know if you need more details.


Thank you for your replay. Here is what i am trying to do. I am trying to setup sql schedule which is going to execute a stored procedure that gets some data then put these data into a pdf file. After that it will send an e-mail to the manger with new created pdf file. How can i accomplish that?
Thank you|||

Quote:

Originally Posted by goal2007

Thank you for your replay. Here is what i am trying to do. I am trying to setup sql schedule which is going to execute a stored procedure that gets some data then put these data into a pdf file. After that it will send an e-mail to the manger with new created pdf file. How can i accomplish that?
Thank you


You can create a Windows service that establishes a connection to the database, polls the database table(s), creates a new PDF file with the data retrieved and sends an email to the manager with this attachment. In the service, you embed a timer component for scheduling tasks. The actual scheduling info can be placed in .config file for starters.

Monday, March 12, 2012

How to Create a Minimal user in DB with no access to view Master DB

Hi,

We are using SQL Server 2005 Management Studio.

I created a Minimal User in an application DB. The user will access tables through stored procedures.

I do not want this user to view any other objects including objects in the Master DB.

I can prevent the minimal user from viewing objects from our application DB.

How do you prevent the minimal user from viewing objects in the Master DB?

Thanks.

Tim.

If u want a particular user should not access Master DB, do not add the user to master DB at all. We generally never add users to master db. Thump rule is that u should control permissions using Role. Create a new role add this user to that role and give permission to Role.

Madhu

|||

The user I setup is not in the Master DB. It seems there are default settings in Public on the Master DB that allow access to view tables within Master. Guest is a member of Public, therefore, users in other DB's can view these tables in Master. I want to know how to prevent this from happening. Or, does it really matter?

Tim.

|||

Why do you care if the user sees objects in master? Those objects are system (you should not store your user data in master, or if you decide to store it, just deny permissions on it to guest) and they are present in any installation, so there's no secret about their existence. The actual contents of the system catalogs are protected via catalog security - so even if your user sees a catalog, he'll only see the entries corresponding to entities he has permissions on. I don't think you should care about this, but if you are having a certain scenario in mind where you think that the information that is visible makes a system vulnerable, let us know about it.

Thanks

Laurentiu

|||

Hi Laurentiu,

Thanks for your answer. My concern was with the access that public has in the master DB. Is there a list or document that shows the initial settings of a master DB? I would like to compare the public permissions in my Master DB with the ones that come with SQL Server 2005 standard?

Is there a rule of Thumb that applies here?

Tim.

|||

You could make a fresh installation on another machine and record the list of permissions, then compare it against your current installation. I don't think there is a published list - it would be hard to maintain from release to release, as system objects are added or dropped in service packs as well.

For the public server role, things are pretty simple, as he only gets VIEW ANY DATABASE and some CONNECT permissions; for the public database role, things are more complicated - on my system I have 1664 various grants of SELECT or EXECUTE permissions. Things would get even more complicated if you install applications that create new objects in master and thus add new grants. However, you could write dedicated scripts to check the list of grants against a copy and report any changes, then you could run these scripts periodically.

Thanks

Laurentiu

How to Create a Minimal user in DB with no access to view Master DB

Hi,

We are using SQL Server 2005 Management Studio.

I created a Minimal User in an application DB. The user will access tables through stored procedures.

I do not want this user to view any other objects including objects in the Master DB.

I can prevent the minimal user from viewing objects from our application DB.

How do you prevent the minimal user from viewing objects in the Master DB?

Thanks.

Tim.

If u want a particular user should not access Master DB, do not add the user to master DB at all. We generally never add users to master db. Thump rule is that u should control permissions using Role. Create a new role add this user to that role and give permission to Role.

Madhu

|||

The user I setup is not in the Master DB. It seems there are default settings in Public on the Master DB that allow access to view tables within Master. Guest is a member of Public, therefore, users in other DB's can view these tables in Master. I want to know how to prevent this from happening. Or, does it really matter?

Tim.

|||

Why do you care if the user sees objects in master? Those objects are system (you should not store your user data in master, or if you decide to store it, just deny permissions on it to guest) and they are present in any installation, so there's no secret about their existence. The actual contents of the system catalogs are protected via catalog security - so even if your user sees a catalog, he'll only see the entries corresponding to entities he has permissions on. I don't think you should care about this, but if you are having a certain scenario in mind where you think that the information that is visible makes a system vulnerable, let us know about it.

Thanks

Laurentiu

|||

Hi Laurentiu,

Thanks for your answer. My concern was with the access that public has in the master DB. Is there a list or document that shows the initial settings of a master DB? I would like to compare the public permissions in my Master DB with the ones that come with SQL Server 2005 standard?

Is there a rule of Thumb that applies here?

Tim.

|||

You could make a fresh installation on another machine and record the list of permissions, then compare it against your current installation. I don't think there is a published list - it would be hard to maintain from release to release, as system objects are added or dropped in service packs as well.

For the public server role, things are pretty simple, as he only gets VIEW ANY DATABASE and some CONNECT permissions; for the public database role, things are more complicated - on my system I have 1664 various grants of SELECT or EXECUTE permissions. Things would get even more complicated if you install applications that create new objects in master and thus add new grants. However, you could write dedicated scripts to check the list of grants against a copy and report any changes, then you could run these scripts periodically.

Thanks

Laurentiu

Wednesday, March 7, 2012

How to creat a sp for insert datas...

hi.. guys...

i want to thank the people who answered my previous thread..

ii want to know how to creat a stored procedure with insert commands that need to be call from a servlet using callableStatement..

i want to know how to create the stored procedure in sql..

i have two tables login_details(username,password), personal_details(Name,Age,dob)..

With advanced thanks..

Ur's

Rams

Quote:

Originally Posted by subramanian_pks

hi.. guys...

i want to thank the people who answered my previous thread..

ii want to know how to creat a stored procedure with insert commands that need to be call from a servlet using callableStatement..

i want to know how to create the stored procedure in sql..

i have two tables login_details(username,password), personal_details(Name,Age,dob)..

With advanced thanks..

Ur's

Rams


---------------
create procedure sp_insert_login
@.username as char(100),
@.password as char(100)
as
insert into login_details(username,password)
values(@.username,@.password)

How to crack encrypted store procedure in SQL 2005?

Dear all,
Is it possible to crack encrypted store procedures in SQL 2005? I have an
application that uses a lot of stored procedures in SQL 2005 that I must
protect the source codes in store procedures. I am worry about users can
crack encrypted stored procedures so my application source codes will be
re-engineering completely.
Please share with me your thoughts how to protect source codes in stored
procedure in SQL server.
Thanks.
Maggie.Maggie,
Yes, they can be cracked.
If it is worth $79.95 to someone: http://www.devlib.net/decryptsql.htm
If it is worth $99 to someone: http://www.elitude.net/
And then there is this from the August 2007 SQL Server Magazine:
http://www.sqlmag.com/Article/Artic...rver_95728.html
Note that the code is downloadable, even if you are not a subscriber who can
read the whole article. It does require a significant number of rights to
be able to run this decryption procedure, but on another server not in your
control you have no control over what people do.
You can encrypt, of course, but legal protection comes through contracts and
other legal agreements.
RLF
"Maggie" <Maggie@.discussions.microsoft.com> wrote in message
news:DB70D424-0BE5-490C-9794-6676AFE47E2E@.microsoft.com...
> Dear all,
> Is it possible to crack encrypted store procedures in SQL 2005? I have an
> application that uses a lot of stored procedures in SQL 2005 that I must
> protect the source codes in store procedures. I am worry about users can
> crack encrypted stored procedures so my application source codes will be
> re-engineering completely.
> Please share with me your thoughts how to protect source codes in stored
> procedure in SQL server.
> Thanks.
> Maggie.
>|||Hi Russell,
Thanks a lot for the reply, it helps me a lot.
Maggie.
"Russell Fields" wrote:

> Maggie,
> Yes, they can be cracked.
> If it is worth $79.95 to someone: http://www.devlib.net/decryptsql.htm
> If it is worth $99 to someone: http://www.elitude.net/
> And then there is this from the August 2007 SQL Server Magazine:
> http://www.sqlmag.com/Article/Artic...rver_95728.html
> Note that the code is downloadable, even if you are not a subscriber who c
an
> read the whole article. It does require a significant number of rights to
> be able to run this decryption procedure, but on another server not in you
r
> control you have no control over what people do.
> You can encrypt, of course, but legal protection comes through contracts a
nd
> other legal agreements.
> RLF
> "Maggie" <Maggie@.discussions.microsoft.com> wrote in message
> news:DB70D424-0BE5-490C-9794-6676AFE47E2E@.microsoft.com...
>
>