Forum Replies Created

Viewing 15 posts - 1,336 through 1,350 (of 13,460 total)

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

    i adapted and created some sample data.

    Declare @MyDay datetime = '2015-01-01'

    ;With MYFirstNames(FName) AS

    (

    Select 'Leonardo' UNION ALL

    Select 'Brad' UNION ALL

    Select 'Arnold' UNION ALL

    Select 'Mark' UNION ALL

    Select 'Matt' UNION ALL

    Select 'Bruce'...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

    if StartShift and EndShift are DateTime data types, you can just use Datediff to get the period of time.

    SELECT DateDiff(minute,StartShift,EndShift) from yourtable.

    if it's a TIME data type, you have to...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: servers list in a domain

    i think the OP might be copy/pasting from the Powershell ISE and getting whitespace tot he right of the values, but that's a product of the results panel, and not...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Easy one for someone that knows C#

    i've done this with excel automation, which you can do in a script task,

    this is a rough example i modified, but I did not explicitly test against your file.

    basically, i'm...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Execute Stored Procedure into Temp Table

    you have to create the table explicitly, and then insert into the table; you cannot take advantage of the INTO #temp without jumping through extra hoops using openquery / openrowset

    CREATE...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: How to prevent user login to SQL Management Studio ?

    dallas13 (12/3/2015)


    Thanks but still its throwing the error message.

    what specific error do you get? also look in the SQL error log for a detailed error instead of an "ended in...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: How to prevent user login to SQL Management Studio ?

    dallas13 (12/3/2015)


    I tried it but its giving me error.

    ALTER TRIGGER [TR_LOGON_APPUSER_SSMS]

    EXECUTE AS OWNER

    i have a couple of model DDL triggers that execute as specific users; i think that's the way...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: How to prevent user login to SQL Management Studio ?

    i think you'll need EXECUTE AS OWNER in the trigger; otherwise it's the end users context, i think, who might not have access to msdb, and thus the ability to...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: How to restrict user to select only few values in multi valued parameter

    in cases like this, i suggest not working around the error, but addressing the error head on: huge query that exceeds 4K or whatever.

    instead of having the report pass a...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Automate - Detach Db's - Move Files Different Drive

    curious_sqldba (12/1/2015)


    how do the files move from one drive to another?

    i'd go with doing it physically.

    if you really want to automated it,

    you might do it via xp_cmdShell and the MOV...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Automate - Detach Db's - Move Files Different Drive

    i use this snippet a lot; but it is centric to a single database, but i bet it gets you 90% there.

    it assumes I KNOW the destination for the...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Invalid column name in variable

    for me, mentally,

    CROSS APPLY = INNER JOIN

    and

    OUTER APPLY = LEFT OUTER JOIN

    so if anything is going to consume the results of the previous JOIN/CROSS (ie using the...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Invalid column name in variable

    this is syntactically correct,, and gives you your start and end indicators, as a set base doperation.

    is this more like what you are after?

    SELECT cdsDescription,st.[1stPos],en.[2ndPos]

    FROM tbCompdistances

    CROSS APPLY(SELECT CHARINDEX(' ',cdsDescription) AS...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Type 2 SCD without merge

    something like this is what i slapped together; does this look right?

    UPDATE MyTarget

    SET

    MyTarget.[IsCurrent] ...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: DBCC CheckDB on large database in HA

    here's the article i have bookmarked from Paul Randal, as mentioned above.

    http://www.sqlskills.com/blogs/paul/checkdb-from-every-angle-consistency-checking-options-for-a-vldb/

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 15 posts - 1,336 through 1,350 (of 13,460 total)