Showing posts with label variable. Show all posts
Showing posts with label variable. Show all posts

Friday, March 23, 2012

Indirect config through SQL table ?

Hi,

How would you set up an environment variable to do indirect config from a SQL db table?

I couldn't find any clues in the BOL or on the net.

Basically, we have one variable but it must contain three things:
1)Connection to DB
2) table name
3) filter (config name in table).

Right?

What is the syntax to specify these?

Thanks

I posted the smae question in a reply to an old thread.
Sorry.

Please use the following format:
connection-manager-name;table-name;filter

Friday, March 9, 2012

Indexes on table variable of table valued function

Hi there,

Can someone tell me if it is possible to add an index to a Table variable that is declare as part of a table valued function ? I've tried the following but I can't get it to work.

ALTER FUNCTION dbo.fnSearch_GetJobsByOccurrence
(
@.param1 int,
@.param2 int
)
RETURNS @.Result TABLE (resultcol1 int, resultcol2 int)
AS
BEGIN

CREATE INDEX resultcol2_ind ON @.Result

-- do some other stuff

RETURN
ENDhttp://support.microsoft.com/default.aspx?scid=kb;en-us;305977&Product=sql2k

Non-clustered indexes cannot be created on table variables, other than the system indexes that are created for a PRIMARY or UNIQUE constraint.|||Thanks for the reply. That link certainly explains it all.

Also I didn't realise that table variables can be stored on disk if MSSQL deems necessary! Taking everything into account I would think temporary tables are somewhat more useful/versatile!?

Cheers.