OVH Cloud OVH Cloud

Instruction CONNECT TO

2 réponses
Avatar
Marie
Je suis sous SQL7 et je voudrais utiliser l'instruction CONNECT TO dans une
procédure stockée pour exécuter des actions d'admin (genre démarrer un job )
alors que la procédure est lancée par un utilisateur.
Je n'arrive pas à faire fonctionner cette instruction définie dans l'aide:
EXEC SQL CONNECT TO gismo.market as test USER sa

Et cela même dans l'analyseur de requete.
Y a t-il une astuce ?

2 réponses

Avatar
lionelp
Bonjour,

C'est une instruction spécifique de l'embedded SQL, ne s'appliqe pas à
transact-SQL.

Référez-vous au chapitre "Creating Jobs" de l'aide en ligne, ce que vous
voulez faire n'est a priori pas possible:
Modifying Job Ownership
For security reasons, only the job owner or a member of the sysadmin role
can change the definition of an existing job, start and stop the job, or give
another user ownership of the job.


Cordialement,
LionelP

Pour info voici ce que di l'aide au sujet de l'embedded SQL:
Programming Embedded SQL for C
Microsoft Embedded SQL for C (ESQL/C) offers programmers an alternative to
writing Microsoft® SQL Server™ 2000 client applications with the DB-Library
for C or Open Database Connectivity (ODBC) application programming interfaces
(APIs). ESQL/C enables you to incorporate Transact-SQL statements into your
C-language programs.

ESQL/C is mainly used for porting your existing applications from other
databases to SQL Server.

Warning: While the ESQL/C API is still supported in Microsoft SQL Server
2000, no future versions of SQL Server will include the files needed to do
programming work on applications that use this API. Connections from existing
applications written using ESQL/C will still be supported in the next version
of SQL Server, but this support will also be dropped in a future release.
When writing new applications, avoid using ESQL/C. When modifying existing
applications, you are strongly encouraged to remove dependencies on ESQL/C.
Instead of ESQL/C, you can use Microsoft ActiveX® Data Objects (ADO), OLE DB,
or ODBC to access data in SQL Server.



"Marie" a écrit :


Je suis sous SQL7 et je voudrais utiliser l'instruction CONNECT TO dans une
procédure stockée pour exécuter des actions d'admin (genre démarrer un job )
alors que la procédure est lancée par un utilisateur.
Je n'arrive pas à faire fonctionner cette instruction définie dans l'aide:
EXEC SQL CONNECT TO gismo.market as test USER sa

Et cela même dans l'analyseur de requete.
Y a t-il une astuce ?



Avatar
SQLpro
Bonjour,

en principe il est possible de faire cette reconnexion au serveur en live
dans l'analyseur de requête 2005 (Management Studio) :
:connect $(variableNomServeur)

Pour cela il faut encapsuler un appel à SQLcmd.exe dans la fenêtre et
activer l'exécution de commandes propre à cet outil (icone).

Mais je n'ai pas réussit à le faire fonctionner, peut être à cause d'un
manque de DAC.

Inspiez vous de cet article :
http://blogs.technet.com/patricg/articles/416019.aspx

A +

"" a écrit :

Bonjour,

C'est une instruction spécifique de l'embedded SQL, ne s'appliqe pas à
transact-SQL.

Référez-vous au chapitre "Creating Jobs" de l'aide en ligne, ce que vous
voulez faire n'est a priori pas possible:
Modifying Job Ownership
For security reasons, only the job owner or a member of the sysadmin role
can change the definition of an existing job, start and stop the job, or give
another user ownership of the job.


Cordialement,
LionelP

Pour info voici ce que di l'aide au sujet de l'embedded SQL:
Programming Embedded SQL for C
Microsoft Embedded SQL for C (ESQL/C) offers programmers an alternative to
writing Microsoft® SQL Server™ 2000 client applications with the DB-Library
for C or Open Database Connectivity (ODBC) application programming interfaces
(APIs). ESQL/C enables you to incorporate Transact-SQL statements into your
C-language programs.

ESQL/C is mainly used for porting your existing applications from other
databases to SQL Server.

Warning: While the ESQL/C API is still supported in Microsoft SQL Server
2000, no future versions of SQL Server will include the files needed to do
programming work on applications that use this API. Connections from existing
applications written using ESQL/C will still be supported in the next version
of SQL Server, but this support will also be dropped in a future release.
When writing new applications, avoid using ESQL/C. When modifying existing
applications, you are strongly encouraged to remove dependencies on ESQL/C.
Instead of ESQL/C, you can use Microsoft ActiveX® Data Objects (ADO), OLE DB,
or ODBC to access data in SQL Server.



"Marie" a écrit :

>
> Je suis sous SQL7 et je voudrais utiliser l'instruction CONNECT TO dans une
> procédure stockée pour exécuter des actions d'admin (genre démarrer un job )
> alors que la procédure est lancée par un utilisateur.
> Je n'arrive pas à faire fonctionner cette instruction définie dans l'aide:
> EXEC SQL CONNECT TO gismo.market as test USER sa
>
> Et cela même dans l'analyseur de requete.
> Y a t-il une astuce ?
>