Viewing 15 posts - 331 through 345 (of 683 total)
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...
July 13, 2006 at 9:54 am
July 13, 2006 at 9:43 am
And here's example 2...
Note that you only really need the bits in purple.
--preparation
create table table1 (id int identity(1, 1),...
July 13, 2006 at 8:43 am
Okay, Eveliene - Here's example 1...
--data
create table #dbs (name sysname, )
insert #dbs
select 'model'
union all select 'tempdb'
July 13, 2006 at 8:19 am
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...
July 13, 2006 at 3:43 am
> I'm not sure it will withstand a Leap Year
How dare you Jeff!
July 13, 2006 at 3:09 am
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
...
July 12, 2006 at 9:43 am
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...
July 12, 2006 at 9:25 am
> 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...
July 12, 2006 at 9:06 am
I'm sure you'll beat me next time!
July 12, 2006 at 6:53 am
How's this?
--function
go
create function dbo.fnGetHouseRenters(@House int) returns varchar(100) as
begin
declare @x varchar(100)
select @x = isnull(@x + ', ', '')...
July 12, 2006 at 6:25 am
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)) +
...
July 12, 2006 at 6:07 am
Goodness. This might be a bit simpler...
select d, year(d + 275)-1 from YourTable
If you need a function, you can use...
July 12, 2006 at 5:35 am
Viewing 15 posts - 331 through 345 (of 683 total)