Forum Replies Created

Viewing 15 posts - 7,681 through 7,695 (of 8,731 total)

  • RE: Converting Access Function in SQL Function, Help

    I'm not sure on how would you manage to use a view if you want to use parameters. You could certainly use a lookup table, but the function I posted...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Converting Access Function in SQL Function, Help

    You should take a look at this article.

    How to Make Scalar UDFs Run Faster[/url]

    Here's an example on what you could do.

    CREATE FUNCTION dbo.tf_Points(

    @Grade AS VARCHAR(10),

    @Type AS INT

    )

    RETURNS TABLE

    AS RETURN

    SELECT...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Using Declared Variables

    That's because you can't use a value from a SELECT, outside the SELECT. To assign the value is easier than you might have thought.

    Declare @ratecodeVar varchar(15)

    SELECT @ratecodeVar = COALESCE(NULLIF(over_rate2,''), NULLIF(over_rate,''),...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Aggregate minutes from varchar datatype.

    The problem is that you can't store a value larger than 24 hours as time. You could use a workaround but you need to be sure to manage the string...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Number Of Columns Per Table

    What about using ROW_NUMBER?

    WITH CTE AS(

    SELECT

    SCHEMA_NAME(t.schema_id) AS schema_name

    , t.name AS TableName

    , i.rows

    , c.column_id AS NumberOfColumns

    , ROW_NUMBER() OVER( PARTITION BY t.name ORDER BY c.column_id DESC) rn

    FROM

    sys.tables t...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How to Update Column based on Due and collection as explained in post

    All I understand would be something like this.

    UPDATE #temp SET

    Princ_Adj = ( Princ_due + Int_Due + Other_Due) - Collection ,

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Can you please anybody one explain?

    Let's make his life easier with this link.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: The working of PIVOT

    You need to use the IFCode tags that you can find to the left of the post editor.

    For SQL Code, you need [ code="sql"][/code] (without the space between the bracket...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Syntax problem joining to select statements

    Put parenthesis aroud the subqueries that will form your datasets.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: modify sql statement from *= to left outer join

    There might be something wrong in the configuration of Powerbuilder (I've never used it). The variables are wrong as well (there's a : where a @ should go).

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Nesting Error for CASE Statement that Isn't Nested

    Does it fails if you change the syntax like this?

    CASE

    WHEN @MonthUnits = 1 THEN GBAN01/100 -- January

    WHEN @MonthUnits = 2 THEN GBAN02/100 -- February

    WHEN @MonthUnits = 3...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: modify sql statement from *= to left outer join

    I'm sure you're not using SQL Server, but I guess this should work as expected.

    SELECT labtrans.transdate,

    labtrans.laborcode,

    labtrans.regularhrs,

    labtrans.startdate,

    labtrans.craft,

    labtrans.refwo,

    task.worktype,

    task.parent,

    parent.wonum,

    parent.location,

    parent.worktype,

    matusetrans.itemnum,

    matusetrans.mrnum,

    matusetrans.transdate,

    matusetrans.actualdate,

    matusetrans.issuetype,

    matusetrans.description,

    matusetrans.storeloc,

    matusetrans.refwo,

    matusetrans.linetype,

    labor.personid,

    matusetrans.issueto,

    asset.eq1

    FROM labtrans

    JOIN workorder task ON labtrans.refwo = task.wonum

    JOIN workorder parent ON task.parent = parent.wonum

    JOIN labor...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: WAITFOR DELAY - Shortest Delay Possible?

    Not exactly a bug, it's just the accuracy for datetime data type.

    You can read about it here.

    http://technet.microsoft.com/en-us/library/ms187819%28v=sql.105%29.aspx

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Inserting into two tables - little help needed

    I'm glad that we could help.

    After a while we all start looking for the simplest way to do it. 🙂

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Any *easy* way to compare database schemas, without a 3rd party tool?

    Have you tried using the view INFORMATION_SCHEMA.COLUMNS?

    It might have the information you need to compare.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 7,681 through 7,695 (of 8,731 total)