select top 2 [ClassName]=1 from ai_mssql.uuu.dbo.SD_InfoClass 
union all 
select top 5 2 from cctv.ceshi.dbo.a

解决方案 »

  1.   

    Set RS = conn.execute("select top 2 *,1 from ai_mssql.uuu.dbo.SD_InfoClass union all select top 5 *,2 from cctv.ceshi.dbo.a")
      

  2.   

    select top 2 *,[from]=1 from ai_mssql.uuu.dbo.SD_InfoClass union all select top 5 *,[from]=2 from cctv.ceshi.dbo.a
      

  3.   

    Set RS = conn.execute("select top 2 *,[type]=1 from ai_mssql.uuu.dbo.SD_InfoClass union all select top 5 *,2 from cctv.ceshi.dbo.a")
    While Not RS.EOF
    response.write(rs("ClassName")&"---"&rs("type"))
    response.write("<BR>")
    RS.MoveNext
    WEnd
      

  4.   

    Set RS = conn.execute("select top 2 * ,1 as 'from' from ai_mssql.uuu.dbo.SD_InfoClass union all select top 5 *,2 from cctv.ceshi.dbo.a")
    While Not RS.EOF
    response.write(rs("ClassName"))
    response.write("<BR>")
    RS.MoveNext
    WEnd
      

  5.   

    不好意思,上面没有把‘1’‘2’输出来,请看下面:
    Set RS = conn.execute("select top 2 * ,1 as 'from' from ai_mssql.uuu.dbo.SD_InfoClass union all select top 5 *,2 from cctv.ceshi.dbo.a")
    While Not RS.EOF
    response.write(rs("ClassName"))"&"----"&rs("from"))
    response.write("<BR>")
    RS.MoveNext
    WEnd