在installshield中运行Sqlscript

时间:2017-01-22 08:52:07

标签: sql-server error-handling installshield running-total sql-scripts

我想在设置我的c#应用程序时运行一个sql server脚本。所以我使用下面的脚本但是我收到错误

USE [master]
GO
/****** Object:  Database [HoghooghDastmozd]    Script Date: 02/11/1395 11:12:19 ب.ظ ******/
CREATE DATABASE [HoghooghDastmozd]
GO
ALTER DATABASE [HoghooghDastmozd] SET COMPATIBILITY_LEVEL = 110
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [HoghooghDastmozd].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [HoghooghDastmozd] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET ARITHABORT OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [HoghooghDastmozd] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [HoghooghDastmozd] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET  DISABLE_BROKER 
GO
ALTER DATABASE [HoghooghDastmozd] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [HoghooghDastmozd] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET RECOVERY FULL 
GO
ALTER DATABASE [HoghooghDastmozd] SET  MULTI_USER 
GO
ALTER DATABASE [HoghooghDastmozd] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [HoghooghDastmozd] SET DB_CHAINING OFF 
GO
ALTER DATABASE [HoghooghDastmozd] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO
ALTER DATABASE [HoghooghDastmozd] SET TARGET_RECOVERY_TIME = 0 SECONDS 
GO
ALTER DATABASE [HoghooghDastmozd] SET DELAYED_DURABILITY = DISABLED 
GO
EXEC sys.sp_db_vardecimal_storage_format N'HoghooghDastmozd', N'ON'
GO
USE [HoghooghDastmozd]
GO
/****** Object:  User [mobtaker]    Script Date: 02/11/1395 11:12:19 ب.ظ ******/
CREATE USER [mobtaker] FOR LOGIN [mobtaker] WITH DEFAULT_SCHEMA=[mobtaker]
GO
ALTER ROLE [db_owner] ADD MEMBER [mobtaker]
GO
ALTER ROLE [db_ddladmin] ADD MEMBER [mobtaker]
GO
ALTER ROLE [db_backupoperator] ADD MEMBER [mobtaker]
GO
ALTER ROLE [db_datareader] ADD MEMBER [mobtaker]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [mobtaker]
GO
/****** Object:  Schema [mobtaker]    Script Date: 02/11/1395 11:12:19 ب.ظ ******/
CREATE SCHEMA [mobtaker]
GO
/****** Object:  Table [dbo].[access]    Script Date: 02/11/1395 11:12:19 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[access](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [usernameID] [int] NULL,
    [accessfrm] [nvarchar](450) NULL,
 CONSTRAINT [PK_access] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[gorohkari]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[gorohkari](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](max) NULL,
    [comment] [nvarchar](max) NULL,
 CONSTRAINT [PK_gorohkari] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[mah]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[mah](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](max) NULL,
 CONSTRAINT [PK_mah] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[messagesettings]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[messagesettings](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [username] [nvarchar](max) NULL,
    [password] [nvarchar](max) NULL,
    [fromm] [nvarchar](max) NULL,
 CONSTRAINT [PK_messagesettings] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[morkhasimamo]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[morkhasimamo](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [IDp] [int] NULL,
    [datetimestart] [datetime] NULL,
    [modat] [nvarchar](max) NULL,
    [typem] [int] NULL,
    [month] [int] NULL,
    [comment] [nvarchar](max) NULL,
 CONSTRAINT [PK_morkhasimamo] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[newuser]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[newuser](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](max) NULL,
    [username] [nvarchar](500) NULL,
    [password] [nvarchar](max) NULL,
    [email] [nvarchar](max) NULL,
 CONSTRAINT [PK_newuser] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[nezam]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[nezam](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](max) NULL,
    [comment] [nvarchar](max) NULL,
 CONSTRAINT [PK_nezam] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[nobatkari]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[nobatkari](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [IDp] [int] NULL,
    [date] [datetime] NULL,
    [nobat] [nvarchar](400) NULL,
 CONSTRAINT [PK_nobatkari] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[nomorkhasi]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[nomorkhasi](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](max) NULL,
    [code] [int] NULL,
    [comment] [nvarchar](max) NULL,
 CONSTRAINT [PK_nomorkhasi] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[personel]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[personel](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [IDP] [int] NULL,
    [IDsemat] [int] NULL,
    [IDvaziyat] [int] NULL,
    [IDnezam] [int] NULL,
    [IDg] [int] NULL,
    [name] [nvarchar](max) NULL,
    [father] [nvarchar](max) NULL,
    [sh] [nvarchar](max) NULL,
    [cmeli] [nvarchar](max) NULL,
    [datetime] [datetime] NULL,
    [tahsilat] [nvarchar](max) NULL,
    [taAhol] [nvarchar](max) NULL,
    [tsabet] [nvarchar](max) NULL,
    [thamrah] [nvarchar](max) NULL,
    [email] [nvarchar](max) NULL,
    [addressm] [nvarchar](max) NULL,
    [addressk] [nvarchar](max) NULL,
    [dateest] [datetime] NULL,
    [img] [varbinary](max) NULL,
 CONSTRAINT [PK_personel] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[readd]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[readd](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [IDp] [int] NULL,
    [date] [datetime] NULL,
    [day] [nvarchar](max) NULL,
    [nobatkari] [nvarchar](max) NULL,
 CONSTRAINT [PK_read] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

/****** 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteReadd]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete readd where ID=@ID
END   




GO
/****** Object:  StoredProcedure [dbo].[DeleteSaatMovazafi]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteSaatMovazafi]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete saatmovazafi where ID=@ID
END


GO
/****** Object:  StoredProcedure [dbo].[DeleteSemat]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteSemat]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete semat where Id=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[DeleteShift]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteShift]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete shiftk where Id=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[DeleteShifts]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteShifts]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete shifts where ID=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[DeleteSoftWareSetting]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteSoftWareSetting]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete softwaresetting where ID=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[DeleteTatilat]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteTatilat]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete tatilat where ID=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[DeleteTempNobatkari]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteTempNobatkari]
    @nobat nvarchar(max),
    @date datetime,
    @IDp int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete mobtaker.tempnobatd where nobat=@nobat and
     CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, mobtaker.tempnobatd.date))) = @date
     and
     IDp=@IDp
END

/****** Object:  StoredProcedure [dbo].[DeleteUsers]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteUsers]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete newuser where Id=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[DeleteVaziyat]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteVaziyat]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete vaziyat where Id=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[DeleteVkhorooj]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[DeleteVkhorooj]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
     Delete vkhorooj where Id=@ID
END





GO
/****** Object:  StoredProcedure [dbo].[EncryptUsers]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[EncryptUsers]
    @ID int
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    open symmetric key passwordcolumn
decryption by certificate mobtakeran
update newuser set password=ENCRYPTBYKEY(KEY_guid('passwordcolumn'),password)
where ID=@ID;
close symmetric key passwordcolumn;
END




GO
/****** Object:  StoredProcedure [dbo].[InsertAccess]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[InsertAccess]
    -- Add the parameters for the stored procedure here

    @usernameID int,
    @accessfrm nvarchar(max)
    AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
INSERT INTO [dbo].[access]
           ([usernameID]
           ,[accessfrm]
           )
     VALUES
           (@usernameID
           ,@accessfrm)
--         open symmetric key accesscolumn
--decryption by certificate hozormobtakeran
--update access set accessfrm=ENCRYPTBYKEY(KEY_guid('accesscolumn'),accessfrm)
--where usernameID=@usernameID
--close symmetric key accesscolumn;
END




GO
/****** Object:  StoredProcedure [dbo].[Insertgorohekari]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[Insertgorohekari] 
    @name nvarchar(max),
    @comment nvarchar(max)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
      INSERT INTO [dbo].[gorohkari]
           (name
           ,comment)
     VALUES
           (@name
           ,@comment
           )
END




GO
/****** Object:  StoredProcedure [dbo].[InsertMessageSetting]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[InsertMessageSetting] 
    @username nvarchar(max),
    @password nvarchar(max),
    @fromm nvarchar(max)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure hereNSERT INTO [dbo].[newuser]
      INSERT INTO [dbo].[messagesettings]
           (username
           ,password,fromm)
     VALUES
           (@username
           ,@password,@fromm
           )
END




GO
/****** Object:  StoredProcedure [dbo].[UpdateSoftWareSetting]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[UpdateSoftWareSetting]
    -- Add the parameters for the stored procedure here
    @ID int,
@comment nvarchar(max),
        @name nvarchar(max),
            @tell nvarchar(max),
                @address nvarchar(max)

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here
    update softwaresetting set name=@name,tell=@tell,address=@address, comment=@comment where ID=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[UpdateTatilat]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[UpdateTatilat]
    -- Add the parameters for the stored procedure here
    @ID int,
    @datetatil datetime,
    @comment nvarchar(max)

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here
    update tatilat set  datetatil=@datetatil,comment=@comment where ID=@ID
END




GO
/****** Object:  StoredProcedure [dbo].[UpdateUsers]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[UpdateUsers]
    -- Add the parameters for the stored procedure here
    @ID int,
    @name nvarchar(max),
    @username nvarchar(max),
    @password nvarchar(max),
    @email nvarchar(max)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here

    update newuser set name=@name, username=@username,password=@password,email=@email
    where ID=@ID
 --   open symmetric key passwordcolumn
    --decryption by certificate mobtakeran
    --update newuser set password=ENCRYPTBYKEY(KEY_guid('passwordcolumn'),password)
    --where ID=@ID
    --close symmetric key passwordcolumn;
END




GO
/****** Object:  StoredProcedure [dbo].[UpdateVkhorooj]    Script Date: 02/11/1395 11:12:20 ب.ظ ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[UpdateVkhorooj]
    -- Add the parameters for the stored procedure here
    @ID int,
    @IDp int,
    @dvorood datetime,
    @dkhorooj datetime,
    @gorohkari int,
    @kasrkar real,
    @ezafkar real,
    @day nvarchar(max),
    @type nvarchar(max),
    @saatmovazafi nvarchar(max),
    @karkard nvarchar(max),
    @karkardbazarib real,
    @ezafkarbazarib real,
    @kasrkarbazarib real,
    @takhirrv nvarchar(max),
    @tajillv nvarchar(max),
    @takhirrk nvarchar(max),
    @tajillk nvarchar(max),
    @date datetime,
    @IDm int,
    @khaleskarkard nvarchar(max),
    @naghes nvarchar(150)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here
    update vkhorooj set IDp=@IDp, dvorood=@dvorood,dkhorooj=@dkhorooj,gorohkari=@gorohkari,kasrkar=@kasrkar,ezafkar=@ezafkar,day=@day,type=@type,saatmovazafi=@saatmovazafi,karkard=@karkard,karkardbazarib=@karkardbazarib,ezafkarbazarib=@ezafkarbazarib,kasrkarbazarib=@kasrkarbazarib,takhirrv=@takhirrv,takhirrk=@takhirrk,tajillv=@tajillv,tajillk=@tajillk,date=@date,IDm=@IDm, khaleskarkard=@khaleskarkard,naghes=@naghes where ID=@ID
END
GO
USE [master]
GO
ALTER DATABASE [HoghooghDastmozd] SET  READ_WRITE 
GO

--create symmetric key passwordcolumn
--with algorithm =triple_des
--encryption By certificate mobtakeran;
--create master key Encryption By password='bananmobtakeran'
--create certificate mobtakeran
--with subject='HoghooghDastmozd';

execute InsertNewUser 'admin','admin','admin','admin@yahoo.com';

我在最后一行得到错误。请帮我解决一下。错误27506

0 个答案:

没有答案