(1) 无聊USE master
GO
CREATE DATABASE test2
ON 
( NAME = 'test data',
   FILENAME = 'D:\mssq1\data\"test 1 data.mdf"',
   SIZE = 10,
   MAXSIZE = 100,
   FILEGROWTH = 5 )
GO都很无聊哈,哈哈,哈哈哈......

解决方案 »

  1.   

    create table TBL_MatterMain
    ( mat_No varchar(8),
     mat_Name varchar(20),
     unit varchar(4),
     mat_Amount int,
     pro_No varchar(10), 
     cli_Name varchar(10),
     sto_No varchar(10),
     ser_No varchar(10) ,
     primary key (mat_No,pro_No)
    )
    ALTER TABLE TBL_MatterMain  add mat_BookAmou int 
       ALTER TABLE TBL_MatterMain  add CONSTRAINT cs_tbl
     CHECK ( mat_BookAmou<=mat_Amount )
      

  2.   

    4
    select * into #原料信息表 from TBL_MatterMain   where sto_No='02'5select mat_No,mat_Name,max(mat_Amount) 最大库存量,min(mat_Amount) 最小库存量,avg(mat_Amount) 平均库存量
    from TBL_MatterMain
    where sto_No='dd'
    group by mat_No,mat_Name
    order by mat_No
    6 7太简单 就是insert update语句8  用joinselect a.mat_No,a.mat_N,a.amemat_Amount,b.Sup_Name,b.Sup_tel
    from TBL_MatterMain a join  TBL_Supplier b  on a.ser_No=b.ser_No
    where a.pro_No='A0212-3' and a.sto_No='外二'
    9 where mat_Name like '%篮%'