Forum Replies Created

Viewing 15 posts - 2,101 through 2,115 (of 8,731 total)

  • RE: How to get date??

    I know what you're trying to do. What you fail to understand is that to get the correct calculation, you need to be able to define how to calculate week...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: count every hour per day

    It probably needs to be more like this to include all the possible hours.

    DECLARE @StartDate datetime = '20010101',

    @EndDate datetime = '20010107';

    WITH

    E(n)...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Maximum number of CROSS APPLY functions

    Jeff Moden (10/2/2016)


    The Dixie Flatline (9/30/2016)


    Fortunately, I only need around 300, not thousands. 😀

    Thanks guys.

    Just curious.... what are you doing that needs so many APPLYs?...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How to get date??

    peter478 (10/3/2016)


    I dont need to define week 1. I know week, year, day and I need to get back date.

    The way you define week 1 will change the week number....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Get the salary based on empno and month

    GA_SQL (10/3/2016)


    But for each month i have 30 employees, how to maintain that in a single table

    What's the problem? You could have 30 million employees and their salaries for several...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How to get date??

    How do you define week 1?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: how can I use a sproc @param as column alias?

    That's not possible without dynamic SQL. That's a bad idea, though.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: how to drop a conatraint on column with default value

    Drop the default and recreate it.

    CREATE TABLE SampleData(

    [EmailDate] [datetime] NOT NULL CONSTRAINT [DF_OnlineDay10_EmailDate_GETDATE] DEFAULT (CONVERT([date],getdate(),0))

    );

    INSERT INTO SampleData VALUES(DEFAULT);

    ALTER TABLE SampleData DROP CONSTRAINT [DF_OnlineDay10_EmailDate_GETDATE] ;

    ALTER TABLE SampleData...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Searching for a value across all columns of a single table

    Different options.

    SELECT v.*

    FROM (

    VALUES

    (1, 'True', 'True', 'True', 'True', 'True', 'True'),

    (2, 'True', 'True', 'True', 'True', 'True', 'True'),

    (3, 'True', 'True', 'True', 'True', 'True', 'True'),

    (4, 'True', 'True', 'True', 'False', 'False', 'True'),

    (5, 'True', 'True',...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Am Beginner please help

    spaghettidba (9/28/2016)


    Luis Cazares (9/28/2016)


    Don't listen to that

    You mean me? Wow, that's quite a way to disagree... 🙂

    Sorry Gianluca, I'm just trying to bring the young padawan into the dark side....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Am Beginner please help

    Don't listen to that, download the developer edition of SQL Server which is free if you just create a (free) account here: https://www.visualstudio.com/dev-essentials/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Remove data - Please help

    Sue_H (9/26/2016)


    It's Oracle so it doesn't matter 🙂 See the original post, Oracle.

    Sue

    I don't see any reference to Oracle and this is a SQL Server site.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Any way to clean up mutually exclusive OR conditions?

    I can't picture a situation in which a CASE statement could be the only option in a WHERE clause.

    I, however, can see a lack of understanding of SQL. I said...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Any way to clean up mutually exclusive OR conditions?

    drew.allen (9/26/2016)


    xr280xr (9/26/2016)


    I don't specifically care about short circuiting. I just need to only evaluate b if a is false and only evaluate c if a and b are false....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Ignoring a non-existent table

    If you can't change the database design, you need to use dynamic sql to recreate the view constantly.

    Here's an idea for a trigger.

    IF EXISTS(

    SELECT *

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 2,101 through 2,115 (of 8,731 total)