Forum Replies Created

Viewing 15 posts - 421 through 435 (of 626 total)

  • RE: Transposing Columns to rows

    Had some time so I added my Dynamic solution. Note that I forgot to add the column names in my first example but it looks like Luis had you...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Transposing Columns to rows

    A simple Unpivot works but if you don't know how many columns there can be you will need to look at a Dynamic Query.

    DECLARE @test-2 TABLE (colx VARCHAR(8), coly VARCHAR(8),...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: How to make sure two different date fields are the same in a query

    I suspect we might need a little more information. When I read

    I'm looking for customers that have the same dates for those fields.

    I'm thinking all you want...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Set time format in create table

    pwalter83 (12/4/2015)


    pwalter83 (12/4/2015)


    GilaMonster (12/4/2015)


    The TIME data type stores a time of day, not a time interval. Since a day has only 24 hours, that's the max that TIME can store...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Set time format in create table

    Here are a couple of examples but I highly recommend you read up on string functions.

    https://msdn.microsoft.com/en-us/library/ms181984.aspx

    DECLARE @time VARCHAR(10) = '25:10:20'

    --Lazy way & will break if pattern is different

    SELECT

    CAST(SUBSTRING(@time,1,2) AS INT)...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: This is why SQL Server Central Forums rock!

    Phil Parkin (11/26/2015)


    So satisfying when you can improve things like that, well done.

    Oh man is it ever! LOL


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: making t-sql 2012 execute faster

    wendy elizabeth (11/13/2015)


    what are scalar user-defined functions used in queries?

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

    Google is your friend. 😉


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Need help with Pivot multiple columns in a single select

    Ok, try something like this:

    DECLARE @RefInfo TABLE (schoolid int, ColumnID int, Value varchar(100))

    DECLARE @test-2TABLE (schoolid int, ColumnID int, Value varchar(100), insertedDate Date)

    INSERT INTO @RefInfo VALUES (1000,1,'PRI'),(2000,1,'PUB'),(3000,1,'SEMI-PUB'),(4000,1,'SEMI-PRI'),(1000,2,'ENG'),(2000,2,'MUSIC'),(3000,2,'ARTS'),(4000,2,'ENG')

    INSERT INTO @test-2 VALUES

    (1000,1,'2001-01-01','2005-12-31 00:00:00'),

    (1000,1,'2002-01-01','2006-12-31...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Need help with Pivot multiple columns in a single select

    Here are a couple of examples:

    DECLARE @RefInfo TABLE (schoolid int, ColumnID int, Value varchar(100))

    INSERT INTO @RefInfo VALUES (1000,1,'PRI'),(2000,1,'PUB'),(3000,1,'SEMI-PUB'),(4000,1,'SEMI-PRI'),(1000,2,'ENG'),(2000,2,'MUSIC'),(3000,2,'ARTS'),(4000,2,'ENG')

    --USING CROSS TABS

    SELECT

    schoolid,

    MAX(CASE WHEN columnID = 1 THEN value END) AS funding,

    MAX(CASE WHEN...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Key Value Pair Table

    Luis Cazares (11/11/2015)


    yb751 (11/11/2015)


    Well I just finished talking with our Dev team and I realized that the attributes do not need to be updated individually. Also any searches would...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Key Value Pair Table

    Well I just finished talking with our Dev team and I realized that the attributes do not need to be updated individually. Also any searches would be offloaded by...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Key Value Pair Table

    Alvin Ramard (11/11/2015)


    I'm not 100% sure of exactly what your situation is, but it looks like you should keep on using that key values pair table. Just make sure you...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Are the posted questions getting worse?

    Brandie Tarvin (11/5/2015)


    Grant Fritchey (11/5/2015)


    GilaMonster (11/5/2015)


    Grant Fritchey (11/5/2015)


    I'd strongly suggest looking at Excel and, maybe even more importantly, PowerBI. the technology is wildly different from what we think.

    PowerBI is very...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Log file (when it grow)

    You can also just right click on the DB in question in SSMS and select reports -> Disk Usage. If you have any Autogrow or even (yikes) Authoshrink events...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • RE: Are the posted questions getting worse?

    Brandie Tarvin (11/5/2015)


    At risk of being lynched: Crystal Reports is probably the easiest ad-hoc reporting tool a user with no experience can learn to use.

    Well I agree with you on...


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

Viewing 15 posts - 421 through 435 (of 626 total)