Forum Replies Created

Viewing 15 posts - 2,491 through 2,505 (of 3,543 total)

  • RE: Urgent~How to use OpenDataSource to query from another server???

    I have posted in your other thread re OPENROWSET. Are these two related?

  • RE: How to use OpenRowSet?

    Join the two queries together, you can reference the result of the OPENROWSET as a table

    SELECT J.Job_ID, J.J_Open_Date, J.J_Priority, J.J_Vendor_ID, P.VendName

    FROM Job_Tracking_Table J

    INNER JOIN OPENROWSET('SQLOLEDB','AMKSQL2';'abc';'cde', 'SELECT VendorID, VendName...

  • RE: Finding datetime range intersections and durations

    DECLARE @hours TABLE (Tagname varchar(256), H int)

    insert into @hours

    select c.Tagname,v.number

    from (

        select a.Tagname,datepart(hour,a.[Datetime]) as [H], min(datepart(hour,b.[Datetime])) as [H2]

        from @History a

        inner join @History...

  • RE: using local variable with IN statement

    Another way

    select var1,var2

    from table1

    where charindex( ',' + var3 + ',' , ',' + @local + ',' ) > 0

  • RE: Previous months information

    quoteplease expalint the (convert(char(8),getdate(),120) + '01' )

    Convert allows you to convert dates to specific formats, eg style 120...

  • RE: Previous months information

    select * from where datepart(m,datecolumn) = datepart(m,getdate()) - 1

    will select previous month on any day of the month

    but will result in either a table scan (or index scan...

  • RE: Multiple Where Clause

    Similar to Kenneth's

    SELECT a.GroupID, a.GroupName, b.NoID, c.ContactNo, Datetime, Detination

    FROM [TableA] a

    INNER JOIN [TableB] b

    ON b.GroupID = a.GroupID

    INNER JOIN [TableC] c

    ON c.ContactNo = b.ContactNo

    WHERE a.GroupID...

  • RE: DECIMAL Data Type Question

    They will both use 9 bytes as you stated but

    (17,3) will only allow a maximum of 14 digits to the left of the decimal point

    (19,3) will allow 16

  • RE: Looping query Parent and child, and childs childs ......

    The only way I have achieved this is to use temp tables and a loop

    In what format do you want the output?

     

  • RE: Moving Data between Text fields

    SUBSTRING is limited to the maximum string length in sql (8000 less any overhead)

    why not just update one table directly from the other like this

    UPDATE p

    SET p.[Description] = d.[Description]...

  • RE: General Question SQL

    GROUP BY

    divides the data into groups and produces a list of unique values (like DISTINCT) and allows counting, summation etc

    so

    select col1 from test group by col1

    will produce the same as

    select...

  • RE: General Question SQL

    Duplicate post !

  • RE: Dynamic Query HELP!

    The data will need an identity column to specify the order of concatenation (or does this not matter?)

    If the table has an identity column (eg rowid) then try

    create table [mytable]...

  • RE: Union query problem

    If I understand correctly and if both tables have the same number and type of columns then this

    SELECT ID1, ID2, col1, col2, colx

    FROM [table1]

    UNION

    SELECT ID1, ID2, col1,...

  • RE: Database Migration Methodology Questions

    In addtion, two things

    When you transfer logins they will not necessarily retain their default database.

    If you transfer sql logins be careful of passwords. If the destination server has a different...

Viewing 15 posts - 2,491 through 2,505 (of 3,543 total)