Forum Replies Created

Viewing 15 posts - 3,481 through 3,495 (of 8,731 total)

  • RE: Are the posted questions getting worse?

    I've heard that legislation might be an issue for some industries.

    In Mexico, banks can't have their information outside of their physical locations.

  • RE: Convert a Date

    ben.brugman (1/25/2016)


    ChrisM@Work (1/25/2016)


    How can the code return incorrect results, Ben? Am I missing something here?

    The name of the month is language dependend. This often leads to trouble.

    When storing a date...

  • RE: Convert a Date

    ben.brugman (1/25/2016)


    Luis Cazares (1/25/2016)


    the problem often relies on keeping the default (us_english)

    I do strongly object to the notion that the default language is English.

    I know in almost all science...

  • RE: Syntax help - How can I find the columns in the PRIMARY KEY

    You can use the sys.index_columns view.

    Select i.name AS index_name,

    c.name AS column_name

    FROM sys.indexes i

    JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id

    JOIN sys.columns c...

  • RE: Convert a Date

    Certainly Ben, language settings can be a problem. However, the problem often relies on keeping the default (us_english) rather than setting a foreign and unexpected language.

    The code might need...

  • RE: Count issue/replace between!!!

    ChrisM@Work (1/25/2016)


    jcachado (1/25/2016)


    This is run with a string in VS 2012, the database table is a mdb (access):

    Dim SQLStringtempprd123 As String = "SELECT CAST([create_dtim],'dd-mm-yyyy'),COUNT(*) AS tot FROM Back_ickpt_prd1 WHERE CAST([create_dtim],'dd-mm-yyyy')...

  • RE: Count issue/replace between!!!

    Of course, there's a syntax error as you're following the FORMAT syntax instead of the CAST syntax.

  • RE: Count issue/replace between!!!

    Please, post the statement using CAST that won't work. Also, post DDL and sample data to know the data types and be able to test with data close to reality.

  • RE: Count issue/replace between!!!

    We wouldn't insist if it didn't work. Here's an example:

    SELECT create_dtim = ABS(CHECKSUM(NEWID())) % 7 + CAST( '20160117' AS datetime)

    INTO #Back_ickpt_prd1

    FROM sys.all_columns...

  • RE: Count issue/replace between!!!

    The order is working fine, because you're ordering strings not dates. That's why 05 comes before 04 and so on.

    Take our advice, replace FORMAT with CAST and you'll solve your...

  • RE: Count issue/replace between!!!

    You should also alias your columns and use the alias in the ORDER BY.

    SELECT CAST(create_dtim AS DATE) AS create_date,

    COUNT(*) AS tot

    FROM Back_ickpt_prd1

    WHERE CAST(create_dtim AS DATE) BETWEEN '20160121'...

  • RE: Convert a Date

    Another option:

    SELECT UPPER( REPLACE( CONVERT(char(11), GETDATE(), 106), ' ', '-'))

  • RE: Temp Table column suddenly becomes NOT NULL ???

    The sysname columns are defined as not nullable.

  • RE: Temp Table column suddenly becomes NOT NULL ???

    Brandie Tarvin (1/22/2016)


    Luis Cazares (1/22/2016)


    You're using sysname as datatype for your columns. Sysname is by default NOT NULL.

    You're effectively not inserting any null values explicitly, but you were missing the...

  • RE: converting the nvarchar value 'MSalreadyhavegeneration' ?

    A view is nothing else than a saved query. It has no compilation by itself and it's not aware of the values stored in the underlying tables.

    That said, somewhere in...

Viewing 15 posts - 3,481 through 3,495 (of 8,731 total)