Forum Replies Created

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

  • RE: Using convert function in create table statement

    pwalter83 (12/8/2015)


    Thanks for your suggestion. However, it still doesn't help with my basic requirement. I have to convert the time duration column in excel specifically where values like 100:20:30 exist.

    People...

  • 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...

  • 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),...

  • 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...

  • 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...

  • 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)...

  • 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

  • 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. 😉

  • 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

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

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