Forum Replies Created

Viewing 15 posts - 676 through 690 (of 2,007 total)

  • RE: Table that has all the dates from 2000 till today

    patelronaks1983 (5/9/2012)


    HI.

    I need a date table that has all the dates from 2000 till today. the Table should look like as below.

    DateSkDateDay

    200001011/1/20001

    200001021/2/20002

    200001031/3/20003

    200001041/4/20004

    200001051/5/20005

    200001061/6/20006

    200001071/7/20007

    200001081/8/20008

    200001091/9/20009

    how can i write sql query ?

    SELECT DATEADD(D,N,'2000-01-01')...

  • RE: RegEx for DBAs

    Solomon Rutzky (5/9/2012)


    To Cadavre:

    I do not dispute your results, but I will dispute your test itself on the grounds that it is not relevant to a situation where someone should...

  • RE: Many aggregates in one query

    eseosaoregie (5/8/2012)


    CREATE TABLE PRODUCTS(

    Product_id int CONSTRAINT pk_products_pid PRIMARY KEY

    ,ProductName varchar(10) null

    ,ProductType varchar(10) null

    ,cost_price float null

    )

    CREATE TABLE SALES(

    SalesOrder_id int CONSTRAINT pk_Orders_sid PRIMARY KEY,

    Product_id INT CONSTRAINT fk_productSales_pid FOREIGN KEY REFERENCES Products(Product_id),

    ,quantity int...

  • RE: insert 100 rows without using loop or union etc.,

    michael vessey (5/8/2012)


    I'm not sure if reading good suggestions from this forum would prevent many of newbies from being "promptly escorted off the premises" after interview with some of us...

  • RE: RegEx for DBAs

    Let's create some sample data to play with first.

    SET NOCOUNT ON;

    IF object_id('dbo.testEnvironment') IS NOT NULL

    BEGIN

    DROP TABLE dbo.testEnvironment;

    END;

    WITH t1(N) AS (SELECT 1 UNION ALL SELECT 1),

    t2(N) AS...

  • RE: DATEDIFF(MONTH,0,getdate())

    I'm sure I've read it somewhere, but to be honest after a quick search all I can find is this: -

    GSquared (12/1/2011)


    You can actually change the zero date at a...

  • RE: DATEDIFF(MONTH,0,getdate())

    anthony.green (5/8/2012)


    it is substituting 0 with the default date of '1900-01-01 00:00:00.000'

    You can change the "zero" date at a server level, so test it before you count on it being...

  • RE: Why cant I reference a column in a SQL Cursor?

    Made a couple of errors in my previous posts.

    DECLARE @ImportType INT = 7001, @ImportID CHAR(2) = '03',

    @ImpDateFrom DATETIME = '2011-12-01', @ImpDateTo DATETIME = '2011-12-31',

    @DateFrom DATETIME = '2010-01-01', @DateTo DATETIME...

  • RE: Why cant I reference a column in a SQL Cursor?

    Right, will probably have another look either tomorrow or Monday but for now I'm calling it a night.

    Realised I didn't need the min or max over() so have got rid...

  • RE: Why cant I reference a column in a SQL Cursor?

    blandry (5/4/2012)


    Lynn / Cadavre,

    No problem - if you can look stuff over in a couple days, that is just fine - this is not any emergency issue.

    Thanks for the heads...

  • RE: Why cant I reference a column in a SQL Cursor?

    Just started to download now, will take a look on Sunday or Monday depending on time.

  • RE: Replacement for Cursors

    vinu512 (5/4/2012)


    I give up...I've banged my head on this for really long....I have come to the conclusion that a loop cannot be avoided in this scenario.

    However un-SetBased( 😛 ) or...

  • RE: Replacement for Cursors

    vinu512 (5/4/2012)


    Thanks Cadavre,

    I really liked this one. Can this be customized a little more?

    Like, if we have the following requirements:

    1. We don't know how many rows there are in the...

  • RE: Why cant I reference a column in a SQL Cursor?

    blandry (5/3/2012)


    Cadavre / Lynn,

    Please check your private message - link and info are in there. BAK file is < 50MB, let me know if you have any trouble getting...

  • RE: insert missing rows for duplicate tables but different databases...

    roy.tollison (5/3/2012)


    i have table in 2 databases.

    tbl1

    f1 char(2)

    f2 char(6)

    f3 char(1)

    f4 char(18)

    f5 ...

Viewing 15 posts - 676 through 690 (of 2,007 total)