Forum Replies Created

Viewing 15 posts - 6,001 through 6,015 (of 13,460 total)

  • RE: Find the no of hours and minutes between two datetime values

    if you are SQL 2000 you can move the CTE to a subquery like this:

    SELECT DATEDIFF(minute,StartTime,EndTime) - BreakPeriod,

    (DATEDIFF(minute,StartTime,EndTime) - BreakPeriod) / 60 as hours,

    ...

    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: Find the no of hours and minutes between two datetime values

    something like this is what you are looking for, i think.

    note how i created consumable data with the Common Table Expression and made sure to create the "right" data types?

    if...

    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: Least privilege required for taking and restoring db backups

    anyone in the db_owner role of an individual database has the ability to backup, restore or drop their own database, without additional server-wide permissions.

    will that work for you?

    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: Books for Newbies?

    here's a link to a nice free ebook to help you get started:

    Troubleshooting SQL Server: A Guide for the Accidental DBA by

    Jonathan Kehayias and Ted Krueger[/url]

    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: Same script...different places.

    just checked, and sp_ms_marksystemobject is available on my SQL2008 machine, but sp_MS_upd_sysobj_category is not.

    maybe a system that was upgraded in place might still have it?

    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: Same script...different places.

    is this a SQL 2000 machine, by chance?

    in SQL 2000, it was possible to set a flag accidentally that set all your procs you create in that session as system...

    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: Store procedure

    MyDoggieJessie (1/27/2012)


    I stand corrected 😀

    Lowell, I love your example however, there's one small error in your code, it errors out at the SELECT:---Can clarkKent see the table...

    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: Store procedure

    MyDoggieJessie (1/27/2012)


    I don't believe this to be accurate - more of a maybe... as it really depends on how you've set up security on the server: Are you granting permissions...

    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: Store procedure

    you only need to grant EXECUTE on a stored procedure.

    by design, if the user has EXECUTE permissions, whatever the proc does, whether INSERT/UPDATE/DELETE, the proc will run successfully, and 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: Database Restore does not have all users

    a full backup is always an exact copy at a certain point of time...so it's just not possible that a backup restores some, but not all users. a backup is...

    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: Blocking users out of the system for a specified time range?

    can't you just have your process change each database to RESTRICTED_USER WITH ROLLBACK IMMEDIATE

    OR

    SINGLE_USER WITH ROLLBACK IMMEDIATE

    to kick them out, do your work or maintenance, and then put...

    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: fn_trace_gettable error if rollover trace file is empty

    Pam just to be sure the path tot eh file is correct, does this work for you?

    i think it works, but does it do what you were looking for?

    --get...

    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: Finding out who dropped a table

    aurato (1/26/2012)


    Thanks, but how can I pick how far back that report goes? It's only showing since 8 AM this morning.

    server wide, it's only the last 100 meg of...

    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: Finding out who dropped a table

    DROP TABLE counts as a DDL function,and would be in the default trace, if it didn't get rolled over:

    fastest way is the built in reports in SSMS:

    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: Create User, Role, Grant Permission

    Laura_SqlNovice (1/24/2012)


    Wow Lowell... this is awesome... your comments on every line has made this code so clear. Thanks a bunch!

    Laura I was feeling a little inspired when i fiddled with...

    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 - 6,001 through 6,015 (of 13,460 total)