Simple Selects

  • Thanks for the question. Learned something new today.



    Everything is awesome!

  • Yeah, this one's interesting. I certainly learned something new today, but I don't see an application yet. Filed away for later if it comes up. Thanks for a thought-provoking question to end the week.

  • I remember stumbling upon that once before, when I was trying to do a "SELECT 4" but put a dollar sign instead. Freaked me out until I saw my typo 🙂

  • +1 Thanks, this never occured to me.

  • Thanks for the question. That's pretty funky.

    - webrunner

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html

  • Thanks for the question.

  • Interesting, thanx.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • good question, thanks for sharing.

  • Interesting -tried it for the £ and it worked.

  • Slightly amusing, not even an implicit conversion here, just a Constant Scan of a Scalar string ($0.0000), guess it works for the most common ISO-4217 currencies' single symbol codes, would be nice to have some documentation on which are supported.

    😎

    Execution plan

    <?xml version="1.0" encoding="utf-16"?>

    <ShowPlanXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.2" Build="12.0.2000.8" xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan">

    <BatchSequence>

    <Batch>

    <Statements>

    <StmtSimple StatementCompId="1" StatementEstRows="1" StatementId="1" StatementOptmLevel="TRIVIAL" CardinalityEstimationModelVersion="120" StatementSubTreeCost="1.157E-06" StatementText="with t(x) as ( select $) select * from t" StatementType="SELECT" QueryHash="0xA7BB3CDFB0D79FF7" QueryPlanHash="0xC216E1DEA96E148" RetrievedFromCache="true">

    <StatementSetOptions ANSI_NULLS="true" ANSI_PADDING="true" ANSI_WARNINGS="true" ARITHABORT="true" CONCAT_NULL_YIELDS_NULL="true" NUMERIC_ROUNDABORT="false" QUOTED_IDENTIFIER="true" />

    <QueryPlan DegreeOfParallelism="1" CachedPlanSize="8" CompileTime="0" CompileCPU="0" CompileMemory="80">

    <MemoryGrantInfo SerialRequiredMemory="0" SerialDesiredMemory="0" />

    <OptimizerHardwareDependentProperties EstimatedAvailableMemoryGrant="206667" EstimatedPagesCached="51666" EstimatedAvailableDegreeOfParallelism="2" />

    <RelOp AvgRowSize="15" EstimateCPU="1.157E-06" EstimateIO="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row" EstimateRows="1" LogicalOp="Constant Scan" NodeId="0" Parallel="false" PhysicalOp="Constant Scan" EstimatedTotalSubtreeCost="1.157E-06">

    <OutputList>

    <ColumnReference Column="Expr1000" />

    </OutputList>

    <RunTimeInformation>

    <RunTimeCountersPerThread Thread="0" ActualRows="1" ActualEndOfScans="1" ActualExecutions="1" />

    </RunTimeInformation>

    <ConstantScan>

    <Values>

    <Row>

    <ScalarOperator ScalarString="($0.0000)">

    <Const ConstValue="($0.0000)" />

    </ScalarOperator>

    </Row>

    </Values>

    </ConstantScan>

    </RelOp>

    </QueryPlan>

    </StmtSimple>

    </Statements>

    </Batch>

    </BatchSequence>

    </ShowPlanXML>

Viewing 10 posts - 16 through 24 (of 24 total)

You must be logged in to reply to this topic. Login to reply