Description d’une table

1
EXEC sp_help Table1;

Procédure stockée

Création

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
IF (OBJECT_ID('MyProcureName') IS NOT NULL)
DROP PROCEDURE MyProcureName
GO

CREATE PROCEDURE MyProcureName
@pCount VARCHAR(50),
@pCartNumber VARCHAR(50)

AS
DECLARE @defaultStoreId bigint = 327 ;
DECLARE @password varchar(512) = 'aPassword' ;
DECLARE @WebAccountID varchar(512) ;

-- Comments
SET @UserAccountID = (SELECT UserAccountID FROM UserAccount WHERE [CardNumber] = @pCartNumber);

INSERT INTO Table1 (....) VALUES (( @WebAccountID, 'test', @password, GETDATE()...);
-- Last Id inserted
SET @Table1ID = (SELECT SCOPE_IDENTITY())
....
RETURN Table1ID
GO

Exécution

1
EXEC [MyProcureName] @pCount = '001', @pCartNumber  = 'xxxxxx66';