1、select custnm from customer where year(start_dt)=year(getdate()) and month(start_dt)=month(getdate())
至于存为sql文件吗,保存时改后缀名即可
问题太多了,回答乱

解决方案 »

  1.   


    create table operator(
    oper_cd char(4),
    oper_nm char(4)
    )op01 mike
    op02 jike
    op03 joe 
    op04 nice
    op05 jen create table cruise(
    cruise_cd char(4),
    cruise_nm char(6),
    oper_id char(4),
    des_city char(10),
    country_nm char(10),
    duration int,
    price int,
    )
    cr01 北京   op01 北京       中国       7 200
    cr02 上海   op01 上海       中国       4 300
    cr03 纽约   op02 纽约       美国       6 4000
    cr04 巴黎   op03 巴黎       法国       10 8000
    cr05 桂林线 op05 桂林       中国       2 800create table curise_book
    ( curise_cd char(4),
      start_dt datetime,
    tot_seats int,
    seats_avail int)cr01 2002-07-01 00:00:00.000 50 10
    cr01 2002-07-05 00:00:00.000 30 8
    cr01 2002-08-01 00:00:00.000 30 8
    cr01 2002-08-11 00:00:00.000 40 3
    cr02 2002-08-11 00:00:00.000 20 3
    cr03 2002-07-11 00:00:00.000 60 10
    cr03 2002-09-01 00:00:00.000 56 7
    cr04 2002-07-17 00:00:00.000 47 6
    cr04 2002-08-17 00:00:00.000 47 6
    cr04 2002-09-17 00:00:00.000 47 6
    cr04 2002-10-17 00:00:00.000 47 6
    cr05 2002-07-05 00:00:00.000 48 5
    cr05 2002-07-15 00:00:00.000 48 5
    cr05 2002-07-25 00:00:00.000 70 58
    cr05 2002-08-25 00:00:00.000 40 17
    cr05 2002-08-15 00:00:00.000 40 17
    create table customer(
    cust_cd char(6),
    cust_nm char(8),
    cruise_cd char(4),
    start_dt datetime,
    no_of_per int)
    cs01   王       cu01 2002-07-15 00:00:00.000 30
    cs02   李       cu01 2002-07-05 00:00:00.000 10
    cs03   赵       cu03 2002-09-05 00:00:00.000 10
    cs04   卫       cu02 2002-08-31 00:00:00.000 40
    cs05   程       cu05 2002-07-01 00:00:00.000 5
    cs06   范       cu01 2002-10-01 00:00:00.000 141. select cust_cd,cust_nm,start_dt from customer
    where substring(convert(char(6),start_dt,112),5,2) in (07,08)
     and convert(char(4),start_dt,112)=datepart(year,getdate())
    2 select a.cruise_cd, a.cruise_nm,no_of_per*price as totalmoney
    from cruise a inner join customer b on a.cruise_cd=b.cruise_cd
    where no_of_per*price<200003 select * from operator where oper_cd not in(
    select a.oper_cd from  cruise a inner join customer b
    on   a.cruise_cd=b.cruise_cd
    where convert(char(8),b.start_dt,112)>20021001
    )4 CREATE  CLUSTERED INDEX CLNDX_CRCDNM 
       ON curise_book (curise_cd) 
    WITH  FILLFACTOR = 20
    7 create procedure CountryCruise
    @country_nm char(10)
    asselect country_nm,duration, price*no_of_per as 价格,tot_seats-seats_avail as 座位数
    from cruise a inner join customer b on a.cruise_cd=b.cruise_cd
    inner join curise_book c on a.cruise_cd=c.curise_cd
    where country_nm=@country_nm
    8 create trigger CheckSeats on customer
    for insert
    asdeclare @cruise_cd char(4)
    declare @no_of_per int
    declare @start_dt datetime
    declare @tmp int
    select @cruise_cd=cruise_cd from inserted
    select @no_of_per=no_of_per from inserted
    select @start_dt=start_dt from insertedselect @tmp=tot_seats-seats_avail from curise_book 
    where curise_cd=@cruise_cd and  start_dt= @start_dt
    if (@tmp<@no_of_per)
    BEGIN
          ROLLBACK TRANSACTION
    END
      

  2.   

    5 的表述行程是什么 价格为price*no_of_per么
      

  3.   

    怪了楼主的“号”是中文的呀!是CSDN的新功能吗??
      

  4.   

    可能填的是WEB裡面的那個識別碼