Forum Replies Created

Viewing 15 posts - 3,256 through 3,270 (of 3,544 total)

  • RE: smalldatetime format question

    In .NET is use

    Now().ToString("s").Replace("T", " ")

    which gives me yyyy-mm-dd hh:mm:ss format, which sql has no problems.

    If you do not want the time portion use

    Now().ToString("s").Substring(0,10)

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Previous date's value

    If all the dates are consecutive then join the table to itself with date-1.

    If the dates are not consecutive then join the table to itself with max(date) < date

    If the...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Using variables within IN

    DECLARE @SomeVariable varchar(10)

    SET @SomeVariable = '1,2,5'

    SELECT * FROM TableA WHERE CHARINDEX(CAST(ColumnB as varchar),','+@SomeVariable+',') > 0

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Update several tables with same column names

    Agree, no simple way.

    If the table names have something unique and common, eg all start with fred (fred1,fred2 etc) the you could use sp_MSforeachtable to repeat the update on each...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: DTS encountered an invalid data value..

    rflewitt,

    The problem with your statement is that sql still has to convert the date to do the isdate check and would fail.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: File Batch Rename

    If your 100 tables have similar names, e.g. all start with peter (peter1,peter2 etc). Then you could use this

    sp_MSforeachtable @command1="update ? set doc = replace(replace('?','[dbo].[',''),']','')+' '+doc",@whereand = "and name like...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: DTS encountered an invalid data value..

    I have the same problem with DTS from a 3rd party db using their odbc driver. My dates are typically 0203-06-10 format (typo!!).

    What I do is to change the transformation...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: How to corrupt a db

    Interesting!

    Hope there aren't any unscrupulous DBA's with a company grudge reading this.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Running scripts from scripts

    If you still want the batch file method, this might do it.

    @echo off
    
    cls
    echo Installing 1 of n
    osql /Sserver /Uuser /Ppassword -ddatabase -b /m-1 -iInstall01.sql -oInstall01.Err
    IF...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Removing Duplicates

    If have understood your logic correctly the this should do the trick

    select x.*
    
    from atable x
    left outer join atable a on a.Computer_Name = x.Computer_Name and a.Operating_System...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Removing carriage returns from text fields

    Use this to either update table in situ or create temp table from original and run query against temp table

    declare @ct int

    select @ct = count(*) from tablea where charindex(char(13),textcol) >...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Clustered SQL Server backup & local drives

    Hi Frank,

    Not to labour this point but I did read some articles on web regarding clustering which stated that each server had a C:\ drive where the software (ie SQL)...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Clustered SQL Server backup & local drives

    I have no experience or knowledge of clustered servers so I found the question impossible to answer. Took a guess and got it wrong

    I looked on...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: add a number to my order line

    declare @IDorder int,@Order_num int

    set @IDorder=1

    select @Order_num = isnull(max(Order_num),0)+1 from order_line where IDorder = @IDorder

    insert into Order_Line (IDorder,Order_num)

    values (@IDorderm,@Order_num)

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select...insert

    Just the same way as you would if they parameter variables, e.g.

    INSERT INTO AccidentMain(

    EmpID,

    DeptID,

    ...

    FName,

    LName,

    Address,

    City,

    State,

    ZipCode,

    ...

    )

    VALUES (

    @EmpID,

    @DeptID,

    ...

    @FName,

    @LName,

    @Address,

    @City,

    @State,

    @ZipCode,

    ...

    )

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 3,256 through 3,270 (of 3,544 total)