Showing posts with label functions. Show all posts
Showing posts with label functions. Show all posts

Wednesday, March 21, 2012

Executin SQL statement from variable in functions

Hello All

Within my function depends on value forming a SQL statement

As Example

set @.SqlString = 'select ' + @.ColumnName + ' from ' + @.tableName + ' where ' + @.whereCond

How can i execute this Statement. within function

Thanks in advance

RK

> Within my function depends on value forming a SQL statement

Sorry, no can do, you cannot execute dynamic SQL in a function. Maybe you

meant to use a stored procedure, not a function.

|||

I can change function to stored procedure within storedprocedure how can i execute a dynamic SQL

My requirement is to open cursor with dynamic SQL.
table name, columns list and conditions are depends on user parameters

|||

> My requirement is to open cursor with dynamic SQL.

You need a cursor and dynamic SQL. Fantastic. First, please read this:

http://www.smmarskog.se/dynamic_sql.html

Then, if you can give better specs, maybe we can help.

http://www.aspfaq.com/5006

|||looks like the site was down (http://www.smmarskog.se/dynamic_sql.html)

is there a way i can a open cursor with dynamic sql.

Our requirement is we have set of related tables with different data but all integer columns

We are trying to create few statistical functions/procs So user can pass Table name and column name and optionally any conditions, so that my function/procs returns results.

|||

Sorry, typo

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

> looks like the site was down

Friday, February 17, 2012

execute functions in sql reporter service

Hello
a. How can I calculate in a function in SQL reporter the date for tomorrow.
Now I've filled in a criteria {fn > now()} which shows me all the coming
projects from today.
I only want to show reports for tomorrow. I know how to do it in VB.NET but
can I used in SQL reporter service ?
b. When I export date values to excel, they are shown as numeric value. In
PDF exporter, it works fine? I've changed my dateformat several times,
nothing helps
c. I need a function like this. I a certain value is smaller than 10, the
word "LOW VALUE" is reporter, otherwise the word "HIGH VALUE" is shownReport expressions are essentially VB.NET
So you should be able to everything inside of the expressions.
With the only caveat is that when report is compiled, by default we import
only following namespaces:
System, System.Convert, System.Math and Microsoft.VisualBasic
If you want to get something from any other namespace you'll need to use
full name notation which include full namespace.
"DEME-Carlo" <DEME-Carlo@.discussions.microsoft.com> wrote in message
news:931C2DD3-84A2-4526-A761-55C5A465E12C@.microsoft.com...
> Hello
> a. How can I calculate in a function in SQL reporter the date for
tomorrow.
> Now I've filled in a criteria {fn > now()} which shows me all the coming
> projects from today.
> I only want to show reports for tomorrow. I know how to do it in VB.NET
but
> can I used in SQL reporter service ?
> b. When I export date values to excel, they are shown as numeric value.
In
> PDF exporter, it works fine? I've changed my dateformat several times,
> nothing helps
> c. I need a function like this. I a certain value is smaller than 10,
the
> word "LOW VALUE" is reporter, otherwise the word "HIGH VALUE" is shown
>
>
>
>