Forum Replies Created

Viewing 15 posts - 7,816 through 7,830 (of 8,753 total)

  • RE: T-SQL : Problem with WHEN ... CASE

    Valbuenito (7/16/2014)


    Hi Eirikur,

    Thanks for your reply.

    But, I do not think that answers my problem because I don't master on my parameter.

    This request comes of Reporting, and the parameter is a...

  • RE: T-SQL : Problem with WHEN ... CASE

    Quick thought, use the NULLIF function

    😎

    USE tempdb;

    GO

    DECLARE @TEST TABLE (STR_VAL VARCHAR(50) NOT NULL);

    INSERT INTO @TEST(STR_VAL) VALUES ('ABC'),('DEF'),('NULL'),('JKL'),('NULL');

    SELECT

    T.STR_VAL

    ,NULLIF(T.STR_VAL,'NULL') AS STR_VAL_NULL

    FROM @TEST T

    Results

    STR_VAL STR_VAL_NULL

    --------...

  • RE: DBA vs Developer

    Hmm, 4,85 x 10^14, that would be one row for each mile of blood vessel in every human on earth:w00t:

    😎

  • RE: Encrypt SSN Example (TDE)

    Here is an example of encryption - decryption of an XML node, the principle is the same for a column.

    😎

  • RE: Concatenating fields into one

    Quick suggestion, add the .value() method to get the correct output

    😎

    select

    mult1.VisitID

    ,mult1.AbstractID

    ,(select

    Response + ','

    from

    [livedb_daily].[dbo].[AbsProjectsQueriesMultCs] mult2

    where

    mult2.VisitID=mult1.VisitID

    and mult2.AbstractID=mult1.AbstractID

    order by

    mult2.VisitID

    ,mult2.AbstractID

    for xml path (''), TYPE).value('.[1]','NVARCHAR(MAX)') as overall

    from

    [livedb_daily].[dbo].[AbsProjectsQueriesMultCs] mult1

    where

    mult1.VisitID='RA0-20120603025910735'

    and mult1.[Query]='Additional Notes'

    group by

    mult1.VisitID

    ,mult1.AbstractID

  • RE: SQL Server Spatial Data - Working with Circles

    This should get you started, find where lines drawn between every other point defining the circle crosses

    😎

    USE tempdb;

    GO

    DECLARE @CIRCLE GEOMETRY = 'CIRCULARSTRING (52.6107417597068 -1.19053984363516, 52.6107417597068 -1.19185949047026, 52.6114844449159 -1.19185949047026, 52.6114844449159 -1.19053984363516,...

  • RE: Need help in retrive the data from openxml.

    panneermca35 (7/15/2014)


    Hi All,

    Please read the following query.

    DECLARE @MyXML XML

    SET @MyXML = '<Item>

    <Item accountnumber="900044010163" versionnumber="1" repaymentdate="2013-09-05" />

    </Item>'

    DECLARE @i INT

    EXEC sp_xml_preparedocument @i OUTPUT, @MyXML

    select * from OPENXML(@i, '/Item/Item') order...

  • RE: SQL Server Spatial Data - Working with Circles

    Simplest method is to use STBuffer, the parameter passed is effectively the radius.

    😎

    DECLARE @CIRCLE GEOMETRY = geometry::Point(1.00,1.00,0).STBuffer(1);

    SELECT @CIRCLE

  • RE: Converting Integer Values to Datetime

    My preferred method would be

    😎

    SELECT DATEADD(HOUR,@hour,CONVERT(DATETIME,CAST(@date AS VARCHAR(8)),112))

  • RE: sp_send_dbmail truncates when attaching query results.

    Francis S. Mazeika (7/13/2014)


    I have 12 SQL 2014 instances in 3 different domains (dev, test, stage).

    Each SQL instance has 3 distinct email profiles and each domain has its own mail...

  • RE: Importing Poorly Formatted Text File

    marg 14154 (7/14/2014)


    I am trying to import a text file to a SQL server table using SISS. I use SSIS but this is my first time in import this type....

  • RE: SQL as a service? How to manage abuse?

    jumbojim22 (7/14/2014)


    Hello,

    Consider a set of static data of which I want people to run their own queries against.

    What methods might be available to prevent someone from either purposely (or...

  • RE: Distinct Statement Mystery

    fgrubercpa (7/14/2014)


    I have a db of Contacts - it's real simple, NAME, ADDRESS, CITY, ST, ZIP, etc...

    I CAN DO

    SELECT ST

    FROM TABLE

    and I get all of the ST...

  • RE: Remove Hyphen from End of String

    My bad or rather a lack of tanker sized industrial strength coffee this morning, the RIGHT function isn't available in SQL Server 2000, sorry about the confusion here.

    😎

  • RE: Difference between ROWS UNBOUNDED PRECEDING And ROWS BETWEEN 2 PRECEDING AND CURRENT ROW

    The answer depends, the default framing of a window function varies depending on the function. As an example, the first_value function has the default framing of rows between unbounded preceding...

Viewing 15 posts - 7,816 through 7,830 (of 8,753 total)