Forum Replies Created

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

  • 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...

  • 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

  • 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...

  • 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.

  • 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...

  • 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...

  • RE: How to corrupt a db

    Interesting!

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

  • 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...
  • 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...
  • 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) >...

  • 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)...

  • 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...

  • 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)

  • 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,

    ...

    )

  • RE: select...insert

    Two ways

    1. Declare the employee columns as input params to proc, in asp before calling InsertAccidentRep call another proc to retrieve them from employee table and then pass them to...

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