Forum Replies Created

Viewing 15 posts - 406 through 420 (of 626 total)

  • RE: Are the posted questions getting worse?

    Phil Parkin (12/22/2015)


    Sean Lange (12/22/2015)


    Lynn Pettis (12/22/2015)


    Silver Spoon really doesn't seem to care about learning anything. Just the answer, that's all he is interested in.

    I really hope there is...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: How to convert DOB to age using DateDiff function

    Lowell (12/22/2015)


    another version, which takes into consideration if the birthday has passed or not:

    DECLARE @DOB datetime

    SET @DOB='1962-12-11'

    SELECT CASE

    WHEN DATEPART(DY,GETDATE()) >= DATEPART(DY,@DOB)

    ...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: How to convert DOB to age using DateDiff function

    It's not too difficult...

    SELECT DATEDIFF (YEAR, '1947-11-22 00:00:00.000', GETDATE()) AS Age

    Checking out the MSDN page would have given you the answer.

    https://msdn.microsoft.com/en-CA/library/ms189794.aspx


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Load date time field to date field

    Something like this worked for me. I used your example and striped out the problem hyphen and inserted into a DATETIME2 column.

    DECLARE @myDateString VARCHAR(30) = '2015-12-22-20:21:43.370000'

    DECLARE @test-2 TABLE...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Load date time field to date field

    I'm not 100% if it behaves differently in SSIS but going from a DATETIME to a DATE data type is an implicit conversion.

    CREATE TABLE #before (myDatetime DATETIME)

    INSERT INTO #before

    VALUES(GETDATE())

    CREATE TABLE...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Calculate Running Total until sum reach input value

    If you only care about which accounts have reached your defined threshold, you could just do something like this.

    DECLARE @CustomerOrders table

    (

    id int,

    account NVARCHAR(20),

    deposit INT

    )

    INSERT...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: subquery error help

    Run your sub query separately and it will become obvious what the problem is.

    SELECT WD#Next-3 FROM dbo.Calendar WHERE DTInt = c.CYCLE_DT

    What value is that statement supposed to use when more...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: How to get a list of all SPs in all user databases?

    Try something like this...

    CREATE TABLE #procList (procCatalog VARCHAR(256), procSchema VARCHAR(256), procName VARCHAR(256))

    INSERT INTO #procList

    EXEC sp_MSforeachdb

    'SELECT ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME

    FROM ?.information_schema.routines

    WHERE routine_type = ''PROCEDURE'''

    SELECT * FROM #procList WHERE procCatalog NOT IN...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Moving data file from to a new location

    I use this simple query for INFO when I need to move files around. Maybe it's just me but I find it easier than digging through menus.

    SELECT name, physical_name,...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Assistance needed converting seconds into hours then sum hours

    The error says it all...you can't sum up a varchar data type.

    Whichever way you decide to do the conversion you should sum the values first then convert it.

    DECLARE @myTable TABLE...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: using SP_WhoIsActive trying to track down the job step

    anthony.green (12/11/2015)


    Remove the ' from around the hex value

    select * from sysjobsteps where job_id = 0xBEB303926F0CE848BA3F9858417DB773

    The hex value is the GUID converted to hex and binary is passed in without...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: using SP_WhoIsActive trying to track down the job step

    You mean something like this?

    USE msdb

    SELECT

    s.name,

    s.job_id,

    sjs.step_name,

    sjs.step_uid

    FROM

    sysjobs s

    JOIN sysjobsteps sjs ON sjs.job_id = s.job_id

    EDIT: Sorry, I didn't pay attention to the post title but it might have been worth reiterating in...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: How to Get SQL to Change Date is Time Goes Past Midnight.

    hazeleyre_23 (12/10/2015)


    I am currently using Time datatype which i think is causing the issue.

    If i was to change my database to datatime datatype would could i get it to just...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Combine text from two records into one

    This is actually a nice little exercise for practice. Although you'd hope that you wouldn't have to normally deal with tables like this. 😉


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Using convert function in create table statement

    pwalter83 (12/8/2015)


    Thanks for your suggestion. However, it still doesn't help with my basic requirement. I have to convert the time duration column in excel specifically where values like 100:20:30 exist.

    People...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

Viewing 15 posts - 406 through 420 (of 626 total)