Forum Replies Created

Viewing 15 posts - 61 through 75 (of 100 total)

  • RE: Help with last part of statement

    SELECT Div_Cat, Contract, [MNAllowable per TRVU], cnt AS mntrvu_mode

      FROM (

             SELECT Div_Cat, Contract, [MNAllowable per TRVU], count(*) AS cnt

             FROM [2004 Single CPT Inv Summary db]p

             WHERE [MNAllowable per...

  • RE: self join rows into one row

    not sure if you can count on the first 3 columns acting as keys, but something like this might work:

     

    select sub.name,sub.lname, sub.mname,subAge.age,subPhone.phone,subLocation.location from

    (select name,lname, mname from

    group by name,lname)sub,

    (select...

  • RE: db_owner

    Thanks for the quick response.  I grow tired of managing the username.object situation.  Not all users are careful about placing 'dbo.' in front of objects.  It makes user and object...

  • RE: DTS giving error when run as job

    The only cause will be security settings.  I would recheck the domain user account one more time (I know this is tedious).  One very simple check you can perform is...

  • RE: Help With DateTime Values

    I would try something like:

    I used @time for an example based on getdate(), yous would be much simpler to use.

    Select row_id from table

    where (select cast(datepart(hh,@time)as varchar)+':'+cast(datepart(mi,@time)as varchar)) <TIME_COL1 and (select...

  • RE: SQL question; Can someone help me?

    select merchantpayorprovider.*, Payor.Name

    from merchantpayorprovider, Payor, Merchantpayors

    where merchantpayorprovider.merchantpayorsid=merchantpayors.merchantid

    and Payor.PayorID=merchantpayors.merchantid

  • RE: Convert Date to a string

    select case when datepart(mm,getdate())<=9 then '0'+cast(datepart(mm,getdate())as varchar)

    else cast(datepart(mm,getdate())as varchar) end

  • RE: Copy database question

    I would do the following if you're doing this on the same server.  The database copy wizard doesn't allow database renaming within the procedure:

     

    1)  Backup your DB_original

    2)  Create DB_copy

    3)  Choose...

  • RE: How to retrieve data from two sql queries??

    Assuming you want something like this in the reult set:

    1stquery.COL1, 1stquery.COL2, 2ndquery.COL3......

     

    Then try:

    select A.COL1, A.COL2, B.COL1, B.COL2

    from (1st query) A, (2nd query) B

    where A.ID=B.ID

    I know this appears to over-simplify the...

  • RE: Flexible Select Procedure

    try this out in query analyzer(it doesn't paste well in the thread)....

     

    declare @op int

    declare @paramvalue int

    (set variables to a value for test)

    declare @sql_script varchar(2000)

    set @sql_script='select table_id from my_table where

  • RE: SQL Server DataTime Format Question

    If you want to store the date as MM/YYYY, then you will need to store it as a varchar.

    If you need to parse out the MM/YYYY in SQL:

    cast(datepart(mm,getdate())as varchar)+'/'+cast(datepart(yy,getdate())as varchar)

  • RE: Email notification wont work

    OK,

    you have SQL Mail working.  one of two mail options (of course not the one that works with job alerts which is what you want)

    Under SQL Server Agent Properties, under...

  • RE: Email notification wont work

    I'd start with this article:  http://www.sqlservercentral.com/columnists/sjones/sqlmailresources.asp

     

    and then look through some of the discussion forums on this site.  very helpful info.  don't forget that the mail profile needs to be...

  • RE: DTS Global Variables

    Place your SQL statement as normal, but where you want to use the global variable use the following:  (?)

     

    For example:  select * from

    where id=(?)

    Then select the "parameters" button...

  • RE: Labeling Row with Number

    can you live with this?:

     

    select identity(int) as line_number,[column] into #temp from

    select * from #temp

    drop table #temp

Viewing 15 posts - 61 through 75 (of 100 total)