Home Forums SQL Server 2008 SQL Server 2008 - General Stored procedure execution from within a data retrieval select statements. RE: Stored procedure execution from within a data retrieval select statements.

  • Welcome to the forums. 🙂

    First, no, you can't call a procedure in-line of another SQL statement to run per row. Those are functions in SQL Server, and they're usually performance killers.

    Secondly, if you show us the code you are using in your proc, we should be able to show you how to make it optimal for large queries and get you into some good practices. If you take a look at the link in my first signature, you'll see what we'd really prefer to help you get that working well.

    In general, however, when you're working with quarters, weekends, holidays, etc, what we usually work with is a calendar table. Setting it up originally can be a bit of a pain but from there you can automate it to be kept up to date, and it solves a host of run-time computational problems, like determining a date's quarter for reporting.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA