Forum Replies Created

Viewing 15 posts - 121 through 135 (of 216 total)

  • RE: cant find null entries in a table, but i know they are there

    You can also use this :

    select * from tableA where isnull(col5,'')=''

     

    Regards ,

    Amit Gupta

  • RE: cant find null entries in a table, but i know they are there

    Use this Query :

     

    select * from tablea where col5=replace(col5,'null','')

     

    Regards,

    Amit Gupta

     

  • RE: Unable to create temporary tables inside functions

    Yes!!

    You can create the Temp tables. in functions.

    set @str='OSQL -S. -damit_db -Usa -P -Q" insert into tbl_v select count(*) from ' + @val +'" -oC:\AB.TXT'

    EXEC master..xp_cmdshell @str,NOOUTPUT

     

    Through the use of...

  • RE: Data type conversion in Stored procedure

     

    For that you have to use : isnull() function.  to handle nulls.

     

    Regards ,

    Amit Gupta

     

  • RE: convert variable interger into string

     

    use this simple Query :

     

    select replace(str('2345',5),' ',0)

    NOTE :

    In place of  '2345' you can use your Column. but it should be convert into a varchar type.

     

    Regards ,

    Amit Gupta

  • RE: selecting data from another server

     

    first try to connect direct to that server through

    Query Analyser.

     

    if it is not connected then you have to register the Sql Server.

    You can do it by EM (Enterprise Manager)

     

    Regards,

    Amit Gupta.

     

  • RE: just deleted tons of data i needed

     

    If you have the latest backup of data, then you can restore over into Current Database,

     

    Regards,

    Amit Gupta./

     

  • RE: selecting data from another server

     

    Use the following Query :

    SELECT a.*

    FROM OPENROWSET('SQLOLEDB','<your serv_name>';'server_login';'password',

       'your sql query ') AS a

    Regards,

    Amit Gupta.

     

  • RE: Goup by ID in order

    Hi,
    You can use the following Query to solve This kind of Problem :
     
    Select * from 
    (SELECT  1 as col,
      mnt_HeaderID as hdr_HeaderID,
      BatchDate +
      NotUsed +
      TransactionCode +
      GrossBatchTotal...
  • RE: adding rows to a table with an identity column

    You can use the following Query :

    But in this case you have to use all the columns of Table A while inserting data into Table B

    insert into tableB

    select <Column names>...

  • RE: Strange behavior

    Hi,

    Acoording to me it is Working fine,,

    When you run the query :

    select char(254)

    it willl return : 'þ'

    In your last Query your string does not contain 'þ'

    character so, it is returning...

  • RE: Simple Query

     

    You Can use  Either :

     

    select * from <tablename> where left(col_name,1)='E'

    It will display to you all the records starting from 'e'

    OR

    select * from <tablename> where col_name  like 'E%'

     

    Both will provide...

  • RE: hOW TO restore database ?

    Sorry ?

    I do't have any backup ?

    but i think it will not  solve my problem??

    Then What  i have to do???

    Regards,

    Amit Gupta

     

     

     

  • RE: Column Existence and insert....

    Hi,

    Use this kind of Query ?

    if exists(select * from information_schema.columns where table_name='???' and column_name='????')

    begin

    //////// if part

    end

    else

    //////// else part

    begin

    end

     

    Regards

    Amit Gupta

     

  • RE: Concatenation & Matching

    Hi ,

    also checks for Null values..

    Select *

    from tab1

    where isnull(col1,'')+isnull(col2,'')+cast(isnull(col3,'') as varchar(20))

    not in (select isnull(col1,'')+isnull(col2,'')+(cast(isnull(col3,'') as varchar(20)) from tab2)

    Regards

    Amit Gupta

Viewing 15 posts - 121 through 135 (of 216 total)