mardi 24 novembre 2015

Creating a stored procedure which returns Warehouse_id

I want to create a Stored procedure that will check 5 things from a table and they are as follows:

  1. Admin Flag
  2. Warehouse_id
  3. User_id
  4. Delete_flag
  5. End_date

After checking this it will return the exact warehouse_id from the table.

The table name is WMS_User_Rights in which Mkey is unique. Please suggest what to do

Below is my Script for WMS_User_Rights table

CREATE TABLE [dbo].[WMS_User_Rights](
    [Mkey] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
    [Warehouse_Id] [numeric](10, 0) NOT NULL,
    [Admin] [char](1) NOT NULL,
    [User_Id] [numeric](10, 0) NOT NULL,
    [Start_date] [datetime] NULL,
    [End_date] [datetime] NULL,
    [Tran_type] [varchar](10) NULL,
    [Created_By] [numeric](10, 0) NULL,
    [Created_date] [datetime] NULL,
    [Last_Updated_By] [numeric](10, 0) NULL,
    [Last_Updated_date] [datetime] NULL,
    [Delete_Flag] [char](1) NOT NULL,
    [Attribute1] [varchar](250) NULL,
    [Attribute2] [varchar](250) NULL,
    [Attribute3] [varchar](250) NULL,
    [Attribute4] [varchar](250) NULL,
    [Attribute5] [varchar](250) NULL,
    [Attribute6] [varchar](250) NULL,
    [Attribute7] [varchar](250) NULL,
    [Attribute8] [varchar](250) NULL,
    [Attribute9] [varchar](250) NULL,
    [Attribute10] [varchar](250) NULL,
    [Attribute11] [varchar](250) NULL,
    [Attribute12] [varchar](250) NULL,
    [Attribute13] [varchar](250) NULL,
    [Attribute14] [varchar](250) NULL,
    [Attribute15] [varchar](250) NULL
) ON [PRIMARY]

Aucun commentaire:

Enregistrer un commentaire