CREATE TABLE [cpqaAnswers].[cpqa].[tbl_SM_CreditInfo](
[IDX][int]IDENTITY(1,1),
[CLICKS][bigint],
[CREDIT_POINT][float],
[ACTUAL_CREDITS][money]
)
Normally, to table the data:
INSERT INTO [cpqaAnswers].[cpqa].[tbl_SM_CreditInfo]
VALUES(500,0.15,500*0.15)
But we're going to be using a stoproc to do the same. Here's the SELECT to see that the table gets created properly:
SELECT * FROM [cpqaAnswers].[cpqa].[tbl_SM_CreditInfo]
And now the sp_:
USE [cpqaAnswers]
GO
CREATE PROCEDURE [cpqa].[sp_SM_updateCreditInfo]
@clicks [bigint],
@creditPoint [float],
@actualCredits [money]
AS
BEGIN
INSERT INTO [cpqaAnswers].[cpqa].[tbl_SM_CreditInfo]
VALUES(@clicks,@creditPoint,@actualCredits)
END
To run the stoproc from TSQL script:
DECLARE @clicks [bigint]
DECLARE @creditPoint [float]
DECLARE @actualCredits [money]
SET @clicks = 500
SET @creditPoint = 0.15
SET @actualCredits = @clicks*0.15
EXEC [cpqa].[sp_SM_updateCreditInfo] @clicks, @creditPoint, @actualCredits