IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MS SQL Server Discussion :

[SQL-SERVER 2000] Remplacer l'instruction GO dans requete


Sujet :

MS SQL Server

  1. #1
    Membre habitué Avatar de Sytchev3
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    433
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 433
    Points : 137
    Points
    137
    Par défaut [SQL-SERVER 2000] Remplacer l'instruction GO dans requete
    Existe il une instruction SQL qui réalise la même action qu'un "GO" ???

  2. #2
    Rédacteur
    Avatar de WOLO Laurent
    Homme Profil pro
    Architecte de base de données
    Inscrit en
    Mars 2003
    Messages
    2 741
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Congo-Brazzaville

    Informations professionnelles :
    Activité : Architecte de base de données
    Secteur : Finance

    Informations forums :
    Inscription : Mars 2003
    Messages : 2 741
    Points : 4 414
    Points
    4 414
    Par défaut
    GO, n'est pas une instruction SQL, mais juste un séparateur dans un batch.
    Vous pouvez paramétrer un autre séparateur ou simplement utiliser le point-virgule.

  3. #3
    Membre habitué Avatar de Sytchev3
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    433
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 433
    Points : 137
    Points
    137
    Par défaut
    Comment paramètre- on un autre séparateur ???

    Ma question peux paraitre simple pour vous

    Merci encore

  4. #4
    Membre habitué Avatar de Sytchev3
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    433
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 433
    Points : 137
    Points
    137
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    /*
     
       mardi 7 février 2006 17:31:45
     
       Utilisateur : sa
     
       Serveur : SRVCOMPTA
     
       Base de données : Transport
     
       Application : MS SQLEM - Data Tools
     
    */
     
     
     
     
    SET QUOTED_IDENTIFIER ON
    GO
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    GO
    SET ARITHABORT ON
    GO
    SET NUMERIC_ROUNDABORT OFF
    GO
    SET CONCAT_NULL_YIELDS_NULL ON
    GO
    SET ANSI_NULLS ON
    GO
    SET ANSI_PADDING ON
    GO
    SET ANSI_WARNINGS ON
    GO
    CREATE TABLE dbo.Tmp_TPEMBALL
    (
    	EMBALLC char(10) NOT NULL,
    	EMBALLL char(30) NOT NULL,
    	PACHATU decimal(7, 2) NOT NULL,
    	UNITESC char(3) NOT NULL,
    	GESSTOC char(1) NOT NULL,
    	CONSIGC char(1) NOT NULL,
    	RECQTEC char(1) NULL,
    	PVENTEU decimal(7, 2) NOT NULL,
    	FOURNIA char(15) NOT NULL,
    	FOURNII decimal(6, 0) NULL,
    	GESTIOA char(15) NULL,
    	GESTIOI decimal(6, 0) NULL,
    	TRSGSTC char(1) NULL,
    	LONGUEG decimal(5, 2) NULL,
    	LARGEUG decimal(5, 2) NULL,
    	HAUTEUG decimal(5, 2) NULL,
    	POIDS0P decimal(8, 3) NULL,
    	PDSSUPP decimal(8, 3) NULL,
    	VOLSUPV decimal(8, 3) NULL,
    	COLSUPQ decimal(5, 0) NULL,
    	DEVISEC char(3) NOT NULL,
    	CPQUAIU decimal(7, 2) NOT NULL,
    	EMBARDC char(2) NOT NULL,
    	DERMAJC char(10) NULL,
    	DERMAJD datetime NULL,
    	CREATIC char(10) NULL,
    	CREATID datetime NULL
    )
    GO
    IF EXISTS(SELECT * FROM dbo.TPEMBALL)
    	 EXEC('INSERT INTO dbo.Tmp_TPEMBALL (EMBALLC, EMBALLL, PACHATU, UNITESC, GESSTOC, CONSIGC, PVENTEU, FOURNIA, FOURNII, GESTIOA, GESTIOI, TRSGSTC, LONGUEG, LARGEUG, HAUTEUG, POIDS0P, PDSSUPP, VOLSUPV, COLSUPQ, DEVISEC, CPQUAIU, EMBARDC, DERMAJC, DERMAJD, CREATIC, CREATID)
    		SELECT EMBALLC, EMBALLL, PACHATU, UNITESC, GESSTOC, CONSIGC, PVENTEU, FOURNIA, FOURNII, GESTIOA, GESTIOI, TRSGSTC, LONGUEG, LARGEUG, HAUTEUG, POIDS0P, PDSSUPP, VOLSUPV, COLSUPQ, DEVISEC, CPQUAIU, EMBARDC, DERMAJC, DERMAJD, CREATIC, CREATID FROM dbo.TPEMBALL TABLOCKX')
    GO
    DROP TABLE dbo.TPEMBALL
    GO
    --Tu ne peux pas renommer un objet que tu as supprimé.
    EXECUTE sp_rename N'dbo.Tmp_TPEMBALL', N'TPEMBALL', 'OBJECT'
    GO
    --Ici aussi la table n'existe pas.
    UPDATE TPEMBALL SET RECQTEC = 'O'
    GO
    CREATE TABLE dbo.Tmp_TPEMBALL
    	(
    	EMBALLC char(10) NOT NULL,
    	EMBALLL char(30) NOT NULL,
    	PACHATU decimal(7, 2) NOT NULL,
    	UNITESC char(3) NOT NULL,
    	GESSTOC char(1) NOT NULL,
    	CONSIGC char(1) NOT NULL,
    	RECQTEC char(1) NOT NULL,
    	PVENTEU decimal(7, 2) NOT NULL,
    	FOURNIA char(15) NOT NULL,
    	FOURNII decimal(6, 0) NULL,
    	GESTIOA char(15) NULL,
    	GESTIOI decimal(6, 0) NULL,
    	TRSGSTC char(1) NULL,
    	LONGUEG decimal(5, 2) NULL,
    	LARGEUG decimal(5, 2) NULL,
    	HAUTEUG decimal(5, 2) NULL,
    	POIDS0P decimal(8, 3) NULL,
    	PDSSUPP decimal(8, 3) NULL,
    	VOLSUPV decimal(8, 3) NULL,
    	COLSUPQ decimal(5, 0) NULL,
    	DEVISEC char(3) NOT NULL,
    	CPQUAIU decimal(7, 2) NOT NULL,
    	EMBARDC char(2) NOT NULL,
    	DERMAJC char(10) NULL,
    	DERMAJD datetime NULL,
    	CREATIC char(10) NULL,
    	CREATID datetime NULL
    	)  ON [PRIMARY]
    GO
    IF EXISTS(SELECT * FROM dbo.TPEMBALL)
    	 EXEC('INSERT INTO dbo.Tmp_TPEMBALL (EMBALLC, EMBALLL, PACHATU, UNITESC, GESSTOC, CONSIGC, RECQTEC, PVENTEU, FOURNIA, FOURNII, GESTIOA, GESTIOI, TRSGSTC, LONGUEG, LARGEUG, HAUTEUG, POIDS0P, PDSSUPP, VOLSUPV, COLSUPQ, DEVISEC, CPQUAIU, EMBARDC, DERMAJC, DERMAJD, CREATIC, CREATID)
    		SELECT EMBALLC, EMBALLL, PACHATU, UNITESC, GESSTOC, CONSIGC, RECQTEC, PVENTEU, FOURNIA, FOURNII, GESTIOA, GESTIOI, TRSGSTC, LONGUEG, LARGEUG, HAUTEUG, POIDS0P, PDSSUPP, VOLSUPV, COLSUPQ, DEVISEC, CPQUAIU, EMBARDC, DERMAJC, DERMAJD, CREATIC, CREATID FROM dbo.TPEMBALL TABLOCKX')
    GO
    DROP TABLE dbo.TPEMBALL
    GO
    EXECUTE sp_rename N'dbo.Tmp_TPEMBALL', N'TPEMBALL', 'OBJECT'
    GO
    1-J'ai noté que tu as utilisé le mot clé GO dans un bloc de transaction.
    Ce qui ne se fait pas.
    2-Si vous voulez utiliser les transactions, remplacer les GO par des points-virgules.
    3-GO signifie que MS SQL Serveur doit executer le lot d'instructions précédent le GO et est donc contraire à la politique des Transactions.

Discussions similaires

  1. Réponses: 5
    Dernier message: 30/05/2007, 18h08
  2. [SQL Server 2000] Recherche d'un ID dans toute la BD
    Par Invité dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 02/04/2007, 14h48
  3. [SQL Server 2000] ajouter une colonne identité dans une vue?
    Par CetTer dans le forum MS SQL Server
    Réponses: 3
    Dernier message: 02/08/2005, 13h43
  4. Copie de donnees dans SQL server 2000
    Par papayou42 dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 19/12/2003, 10h58
  5. Procedure stockée avec ntext dans SQL server 2000
    Par nagababa dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 20/11/2003, 20h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo