Forum Replies Created

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

  • RE: Dynamic getting value of table_name??

    I'm curious as to what you're actually trying to do with this, Papillon. What is the cursor for?

    Anyway, you should probably read this...

    http://www.sommarskog.se/dynamic_sql.html#Dyn_table

    And be aware of this (which you...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Reading ID from XML file???

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=69030

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deriving financial years

    Group hug?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: SQL executing on multiple DB''''s (but not all)?

    And here's example 2...

    Note that you only really need the bits in purple.

    --preparation

    create table table1 (id int identity(1, 1),...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: SQL executing on multiple DB''''s (but not all)?

    Okay, Eveliene - Here's example 1...

    --data

    create table #dbs (name sysname, )

    insert #dbs

              select 'model'

    union all select 'tempdb'

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: SQL executing on multiple DB''''s (but not all)?

    Hi EA,

    > It will do the job, but it is not wat I was looking for.

    If it will do the job, what is the problem?

    I'm afraid I don't understand what...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deriving financial years

    > I'm not sure it will withstand a Leap Year

    How dare you Jeff!

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: SQL executing on multiple DB''''s (but not all)?

    You can use sp_MSforeachdb to run against all dbs, and then just check the db before you run what you need. e.g.

    create table #dbs (name sysname)

    insert #dbs

             ...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deriving financial years

    Okay. It's hard for me to tell whether we're going down the wrong path or not, since I don't have enough information to understand what you're trying to do. So...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deriving financial years

    > Also, can I create a function within a SPROC or does it permanently reside separately in the database?

    It permanently resides separately in the database.

    > How do I set the...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Produce a list of users and whose houses they rent

     

    I'm sure you'll beat me next time!

     

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Division Problem

    > I must be fooled of overwork

    Aren't we all!

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Produce a list of users and whose houses they rent

    How's this?

    --function

    go

    create function dbo.fnGetHouseRenters(@House int) returns varchar(100) as

    begin

        declare @x varchar(100)

        select @x = isnull(@x + ', ', '')...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Division Problem

    How about...?

    select (cast (3 as float)/cast (23 as float)) +

           (cast (4 as float)/cast (23 as float)) +

           (cast (7 as float)/cast (23 as float)) +

          ...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deriving financial years

    Goodness. This might be a bit simpler...

    select d, year(d + 275)-1 from YourTable

    If you need a function, you can use...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

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