Forum Replies Created

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

  • RE: Truncate and Re-Load

    It is a good bit of work to include all of the columns.

    However sql2005 allows you to right click the table and script insert. Then use the...

  • RE: Extract Numeric Records From Character Type

    Short and sweet, however SQL considers characters like . to be numeric.

    create table #tmp( tc char(2))

    insert into #tmp

    select '11' union all

    select '1a' union all

    select 'a1' union all

    select '1 ' union...

  • RE: Extract Numeric Records From Character Type

    If your only working on char(2) the idea below is fairly straight-forward.

    create table #tmp( tc char(2))

    insert into #tmp

    select '11' union all

    select '1a' union all

    select 'a1' union all

    select '1 '...

  • RE: several cents off by using sum and avg function

    For product1 you have a total of 998.02

    When you divide that by 5 you get 199.604 ~ average.

    When it converts 199.604 to dec(15,2) you get 199.60.

    When you multiply 199.60...

  • RE: Function to cast an integer to a varchar where 1 = A, 26 = Z, ...

    I had the job of creating alpha-numeric barcodes for my current job. I controlled the data and used an identity column to feed the function below.

    It is...

  • RE: Aggregate Error

    My 2 cents would to be remove the queries from the select and instead but them into derived tables

    select ap.id, ap.descrip. ap.suggestedJobQty

    , apr.yada

    , aps.yada

    FROM @ap

    INNER JOIN

    ( select...

  • RE: 3rd party Connecting to SQLServer 2005 OLE

    MDAC MDAC MDAC...

    Person onsite updated the MDAC to the latest version and viola!.

    Daryl

  • RE: SQL help

    SELECT v.Description, b.branchName

    FROM branchAssignmentTable bat

    INNER JOIN Vehicle v ON v.uid = bat.VehicleID

    INNER JOIN Branch b on b.uid = bat.BranchID

  • RE: Creating Custom database role

    I went in to db_datareader and db_datawriter and VIOLA! Got to get out of my box more often. It never occurred to me to add the new role...

  • RE: Creating Custom database role

    Steps:

    create database role, add db_datareader and db_datawriter

    Security (not under database)

    create new SQL Server Authentication Login Name:'logintest'

    Under UserMapping select target_database and created role.

    [ok]

    In the target_database I can find the new user/login...

  • RE: Group results by the hour?

    create table #tmp (id int identity, mydate datetime)

    insert into #tmp (mydate) values (getDate())

    select datepart(hh, mydate), count(*)

    FROM #tmp

    group by datepart(hh, mydate)

  • RE: Querying table2 with results from table1 and displaying data from both tables

    If you need to have dynamic sql...

    The code below should give you the results you are looking for.

    create table tmp2004 (descID int, amt numeric, share numeric(4,2)

    create table tmp2005 (descID int,...

  • RE: using DOS START command inside of xp_cmdshell

    In the past I created a nightly process that kicked off jobs from a table schedule.

    I wanted the sproc scheduler to kick off individual threads. I solved the problem...

  • RE: Selecting Latest Records

    This should return a list of 'other' by listname and latest date.

    create table #myLists

    (id int identity, other varchar(20), listName varchar(20), insertDate datetime)

    select listName, other, insertDate

    from #myLists ml

    INNER JOIN

    (select...

  • RE: TRIGGER QUESTION

    Sorry about the double post, stupid firewall.

    I like Sergiy's additional where comment i.status d.status

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