Ask a Question related to Microsoft SQL / MS SQL Server, Design and Development.
-
Vinodk #1
Re: Choosing a column on the fly
You can use Dynamic SQL ... To achieve the same ...
--
HTH,
Vinod Kumar
MCSE, DBA, MCAD
SCT Software Solutions
[url]http://www32.brinkster.com/sqlvinod[/url]
"DC" <dc@upsize.de> wrote in message news:5b7bac12.0307100535.36ce77c1@posting.google.c om...> Hi,
>
> depending on the permissions of the requester, I need to return
> different columns. Example table "testvals":
>
> id value1 value2 time1 time2 permissionmask
> 1 A B 20030101 20030102 1
> 2 C D 20030103 20030104 4
>
> The stored procedure that queries the values should look like this:
>
> create procedure getdata
>
> @perms int
>
> as
>
> select
> value = case when @perms & permissionreq = @pers then value1 else
> values 2 end,
> time = case when @perms & permissionreq = @pers then time1 else time2
> end
> from testvals
>
> return 0
>
>
> This way, if a permission is set, value1 and time1 will be retrieved.
> I could make this a tiny bit nicer by using a funktion like
> "fnchoose(@persm, permissionreq, value1, value2)" but I think it is
> still quiet a slack approach, especially since the select clauses will
> acutally be dynamic sql and my app is already in use but without the
> alternative column.
>
> So I have to rewrite all the dynamic sql statements and also instruct
> my customers to instead write "value" as part of a dynamic sql clause
> to insert a long case construct or a function call.
>
> So my question is, if I already have select clauses like
>
> select value, time from testvals
>
> can I somehow manipulate this query throught the use of a view or
> something to work out my column selection requirement?
>
> Any comments would be great,
>
> regards
>
> DCVinodk Guest
-
Choosing engine
Hi, List! I've read part od mysql documentation on www.mysql.com, but I'm frustraded beacuse I' haven't see a feature matrix to compare engines... -
Choosing a datagrid column
I want to display a column in a datagrid such that each item/row in that column acts as a hyperlink. Further, when I click on the hyperlink, it... -
Choosing typeface for client
Hi, I'm relatively new to the game, so please bear with. How do experienced designers get around using typefaces for concept designs without... -
choosing one file from dir
hello and please excuse my clumsy english. I'm really fresh in php (just want to make one small script for myself, haven't fount such on net) and... -
color choosing
Anyone know where I might find a good snippet of code for choosing a Color value? As opposed to a mere textbox where one inputs #000000 Thanks,...



Reply With Quote

