Forum Replies Created

Viewing 15 posts - 451 through 465 (of 2,458 total)

  • RE: T-SQL equivalent of To_number

    dimpythewimpy (9/20/2016)


    Here's the code I have. Can someone please suggest an improvement. Is it syntactically correct?

    CREATE FUNCTION [HSIP].[Isnumeric]

    (

    @sResponse_string varchar(250)

    )

    RETURNS BOOLEAN

    AS

    BEGIN

    RETURN

    DECLARE @Output AS INT

    select @Output= CASE @sResponse_string

    WHEN @sResponse_string= ISNUMERIC(REPLACE(REPLACE(@sResponse_string, ',',''),'$',''))...

  • RE: Use SSRS as a web application?

    I have used SSRS for like this (as both a data input and for data retrieval) and think SSRS is terrible for this. The main problem is that you have...

  • RE: Convert time from one format to another

    drew.allen (9/19/2016)


    JALLYKAMOZE (9/19/2016)


    i need to convert a time format to another format

    eg. if the time format is 6, how can i convert it to 0600

    please assist

    TIME data DOES NOT...

  • RE: Convert time from one format to another

    JALLYKAMOZE (9/19/2016)


    Thanks Allan, this throws an error, i passed the column in the table and set that column as the default value for the variable @time ,

    i did this:

    DECLARE @Starttime...

  • RE: Convert time from one format to another

    Assuming the 6 in your example represents an hour you could do this:

    DECLARE @time varchar(10) = 24;

    SELECT MAX(CONCAT(REPLICATE(0,2-LEN(@time)),@time,'00'))

    WHERE @time BETWEEN 0 AND 24;

    This returns the time in military format;...

  • RE: need to extract text from given string

    My solution:

    -- sample data

    DECLARE @sampleData TABLE (stringID int, string varchar(1000));

    INSERT @sampleData

    VALUES

    (1, 'Day20ReminderCampaign2016_09_15_13:46:57'),

    (2, 'Day3ReminderCampaign2016_09_19_02:28:39');

    --Solution

    SELECT

    stringID,

    part1 = SUBSTRING(string,1,split-1),

    part2 = STUFF(REPLACE(SUBSTRING(string,split,8000),'_',''),9,0,' ')

    FROM

    (

    ...

  • RE: Select statements included within a function cannot return data to a client: SQL server 2014

    You can't assign the results of a query that returns multiple rows or columns to the value of a variable. This is not allowed:

    DECLARE @sRESPONSE_STRING VARCHAR

    set @sRESPONSE_STRING = (SELECT...

  • RE: How best to handle non-normalized data

    ...if I have 100 different favorite types stored in this way, that's going to be a very wide non-clustered index.

    That is a potential design problem - I would consider...

  • RE: How best to handle non-normalized data

    Vendor Databases are generally not designed by database gurus which is a good thing, it helps keep us database people employed.

    For a situation like this, clustered indexes, non-clustered indexes...

  • RE: Temporary Functions?

    Ben Teraberry (9/15/2016)


    Joe asked: "Can you give me example of something that has to be done with the CLR instead appear SQL?"

    A while back I did a C# CLR function...

  • RE: % of total count

    Gazareth (9/15/2016)


    Also SUM with OVER()

    DECLARE @table TABLE (stateName varchar(20), Count1 int, TotalChargeOffAmount int);

    INSERT @table

    VALUES

    ('Alabama',5,1000),

    ('Arizona',2,4000),

    ('Arkansas',3,5000);

    SELECT

    stateName,

    Count1,

    TotalChargeOffAmount,

    100.0*Count1 / SUM(t1.[Count1]) OVER...

  • RE: % of total count

    DECLARE @table TABLE (stateName varchar(20), Count1 int, TotalChargeOffAmount int);

    INSERT @table

    VALUES

    ('Alabama',5,1000),

    ('Arizona',2,4000),

    ('Arkansas',3,5000);

    SELECT

    stateName,

    Count1,

    TotalChargeOffAmount,

    [% of Total Count] = ((Count1*1.)/CountTotal)*100

    FROM @table t1

    CROSS...

  • RE: Split a string on Commas - except when it has a numeric character immediately on either side of it

    Phil Parkin (9/15/2016)


    Steven.Grzybowski (9/15/2016)


    Jeff Moden (9/14/2016)


    Best way to fix this is to have a pork chop dinner with the people that are providing the data. 😉

    I wish I could....

  • RE: Split a string on Commas - except when it has a numeric character immediately on either side of it

    Alternatively, you could create a specialized version of DelimitedSplit8K_LEAD[/url] that handles this (I'll let you come up with a better name;-)). My modification is bold/underlined.

    CREATE FUNCTION [dbo].[DelimitedSplit8K_LEAD_XX]

    --===== Define I/O...

  • RE: How to bring ZipFiles from another Server

    What lptech posted may help. This is a pretty simple task. The way I would approach it is to:

    1. Create a script task (whatever language works for you) that compares...

Viewing 15 posts - 451 through 465 (of 2,458 total)