Forum Replies Created

Viewing 15 posts - 331 through 345 (of 369 total)

  • RE: Problem in plsql function

    That "slim chance" is here:

    "$BODY$" - what is that ? Compiler probably asks the same 🙂 Get rid of that.

    Functions cannot change database data (UPDATE/DELETE/INSERT are not allowed).

    Using loops is...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: SQL Server 2008R2 Peek 100%

    Do a short trace (5 seconds will probably be enough) with sql profiler, with event "SP:Starting" and "SP:StmtStarting".

    You will probably find function or computed column that is called zillion times.

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Change rows into column and vice versa without using pivot method.

    I'll show you simple example.

    First, prepare test data:

    SELECT name = 'age', value = 20

    into #fact

    union all

    SELECT 'age', 30

    union all

    SELECT 'age', 40

    union all

    SELECT 'height', 180

    union all

    SELECT 'height', 190

    select * from #fact

    WITH...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Difference between Namespace & Schema

    You cannot have two objects with the same name in a namespace.

    In Orace, schema equals to user, and schema is a namespace. You cannot have two objects of the same...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Discovering Foreign Key Constraints

    Or simply press XDetails button (free plugin) on that table name in sql editor,

    and you'll see all info you need.

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: SQL or GUI

    I write a lot of t-sql and use XDetails (www.sqlxdetails.com) to look-up tables and columns.

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Dynamic SQL with Set Operation

    Maybe this could work for you:

    build a batch of sql commands and store them into varchar(max).

    Call it with parameters using sp_executesql.

    Example with two sql command in one batch:

    EXEC sys.sp_executesql N'select...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Oiling the gears for the data dictionary

    Documenting the database is very important.

    You can see descriptions next to the table columns quite easily with XDetails plugin (free): http://www.sqlxdetails.com

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Where is place to store description of Columns?

    You can also see column descriptions next to each column with this very useful addin: http://www.sqlxdetails.com

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Dynamic SQL with Set Operation

    No, you cannot do that. You could maybe build your query with UNION ALL of the queries and get the result you wanted.

    Are you sure you cannot avoid dynamic queries...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: CASE Function

    You're welcome! 😉

    jfm3


    what exactly is "ws" used with the STUFF function?

    "ws" is alias I choosed for #WeekSchedules table, ommiting optional "AS" keyword (I could write "from #WeekSchedules AS ws" or...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: CASE Function

    jfm3 (2/7/2011)


    Sometimes I do use tallies, however, at the moment I simply need to list instances of people who have special days in their schedules. I need to see...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: CASE Function

    All that you want in one short answer:

    Prepare the data (you should have posted that!):

    select MondayRequired='x', TuesdayRequired='x', WednesdayRequired = 'x', ThursdayRequired='x', FridayRequired='x'

    into #WeekSchedules

    union all select 'x', '', null, '', 'x'

    union...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: i want simple example of using joins

    Try this

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • RE: Need help writing a query please

    Hi.

    Solution provided so far will not work.

    You can use a neat trick with CASE nested in the SUM() aggregate function.

    With that trick, solution is really simple, and even without joins:

    Prepare...

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths

Viewing 15 posts - 331 through 345 (of 369 total)