两个问题1.if object_id('#t') is not null  drop table #t;select  * into #t  from   Northwind.dbo.Orders总是报  #t 已经存在
2.select * from  Northwind.dbo.Orders where  orderId like '%_%' 为什么总是把全部查询出来,查询条件没有作用,

解决方案 »

  1.   

    ----1题
    if object_id('#t') is not null  drop table #t
    go select  * into #t  from  Northwind.dbo.Orders
      

  2.   

    ---这样试下 
    select * from  Northwind.dbo.Orders where  orderId like '_%'
      

  3.   


    if object_id('#t') is not null  drop table #t; go ---加go,表示批处理结束
    select  * into #t  from  Northwind.dbo.Orders 总是报  #t 已经存在 
    2. select * from  Northwind.dbo.Orders where  orderId like '%!_%' escape '!' 
      

  4.   

    if object_id('#t') is not null  drop table #t; 
    go --加个go
    select  * into #t  from  Northwind.dbo.Orders select * from  Northwind.dbo.Orders where  orderId like '%[_]%'
      

  5.   

    if object_id('temp..#t') is not null  drop table #t; 
    go --加个go
    select  * into #t  from  Northwind.dbo.Orders 
      

  6.   

    if object_id('tempdb..#t') is not null  drop table #t
    go --加个go 
    select  * into #t  from  Northwind.dbo.Orders 
      

  7.   

    这个表是临时表 
    if object_id('tempdb..#t') is not null  drop table #t; 
    go
      

  8.   

    if object_id('#t') is not null  
    GO 
    drop table #t; select  * into #t  from  Northwind.dbo.Orders 
      

  9.   

    if object_id('#t') is not null  drop table #t ; select  * into #t  from  Northwind.dbo.Orders 错了,晕,有分号
      

  10.   

    select * from  Northwind.dbo.Orders where  orderId like '%[_]%' 
    这是因为_也是通配符