Showing posts with label assign. Show all posts
Showing posts with label assign. Show all posts

Wednesday, March 21, 2012

How can i assign customize data to sql report

hi folks,
i want to assign customize data to sql report. i have one record related to a customer. i have its current balance. i have to show in report that after specific months how much its amount will be.
i have to show each years amount that user will get. i am showing report in my aspx page. how can i assign this customize dataset to report

Good Morning or Good Evening!
I could be mising something based upon your post - but -
When you develop a report in REporting Services - you have to define a DataSet
The dataset can "grab" data from Sql and you can define a text string (Select whatever, count(1) from whatevertableyouwant)
The dataset could also execute a stored procedure and if you have this information available within your database a T-SQL stored proc ) can be executed via the dataset definition of reporting services - then -
you should have no problems in defining the report display elements
still not sure - but I think not so hard!
best regards.

How can I assign a value to a textbox programmatically in a report?

For example: If I want to display the date today, txtDate.Text = DateToday;Type
=System.DateTime.Now
into the Textbox and set the Format (right-click->properties) to dd.MM.yyyy or your corresponding date-format
|||that's design time, what i'm trying to do is at run-time I want to assign a value to a particular textbox in the report. ΓΌ|||There is no way other than assigning a expression to the Textbox. The "MS Access way" doesn't work anymore ;(
You can do something like:
=iif( some_condition = true, System.DateTime.Now, "No Date")

or create your own function:
Add
Public Function myFunction(val as Object)
if val is Nothing then return System.DateTime.Now
return "Empty"
End Funcion

to Report-Properties->Code
and call it by
=Code.myFunction(Fields!ConditionColumn.Value)

|||ok thanks, i'll try your solution later. sql

Monday, March 19, 2012

how can a user who is in a role assign his role to another user?

I create a role(eg. HighOperators), and add user 'ABC01' into it. 'ABC01'
is not a member of the sysadmin fixed server role or the db_owner fixed data
base role or the db_securityadmin fixed database role, can he assign his ro
le to another user?
In SQL Server Books Online, it says " Role owners can execute sp_addrolememb
er to add a member to any SQL Server role they own". but I don't know how to
set or get the a role's Owner.The only way I know to set the role owner is when you create
the role, specify the owner of the role in the second
argument for sp_addrole.
In terms of retrieving the owner, I don't remember there
being a direct way. I think it may be that the altuid in
sysusers is the uid for the owner of the role.
-Sue
On Tue, 27 Apr 2004 05:31:04 -0700, samuelzhu
<anonymous@.discussions.microsoft.com> wrote:

>I create a role(eg. HighOperators), and add user 'ABC01' into it. 'ABC01'
is not a member of the sysadmin fixed server role or the db_owner fixed dat
abase role or the db_securityadmin fixed database role, can he assign his r
ole to another user?
>In SQL Server Books Online, it says " Role owners can execute sp_addrolemember to a
dd a member to any SQL Server role they own". but I don't know how to set or get the
a role's Owner.

Friday, March 9, 2012

how assign value to cursor using sp_executesql procedure

What is error here when i declare cursor ?

declare curQueryVehicleHave cursor for
exec sp_executesql @.strQueryVehicleHave

@.strQueryVehicleHave this string contain a queryMaybe someone can offer a better alternative, but as far as I know you can't do it that way. You will need to place the results of the EXEC into a #temp table and then use the #temp table as the source of your cursor.

At the risk of looking like an idiot, this is my testing code:


DECLARE @.myQuery nvarchar(800)
SET @.myQuery = 'select div_code from division'
DECLARE @.div_code varchar(10)
CREATE Table #Temp (div_code varchar(10))

INSERT INTO #Temp (div_code) EXECUTE sp_executesql @.myQuery -- note that a table variable will not work here

DECLARE curQueryVehicleHave CURSOR FOR SELECT * FROM #TEMP

OPEN curQueryVehicleHave

FETCH NEXT FROM curQueryVehicleHave INTO @.div_code

WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT @.div_code
FETCH NEXT FROM curQueryVehicleHave INTO @.div_code
END

CLOSE curQueryVehicleHave
DEALLOCATE curQueryVehicleHave
DROP TABLE #Temp

Terri|||I hate this about SQL Server. I'd like to see a syntax like

insert into TableName (Columns, ...)
select Columns, ...
from
exec StoredProc

Please SQL Server people?