update database from report

  • hi, my question is - how can i update database direct from report service .

    thank's

  • Can you be a bit more specific? Are you looking to gather data in a report and the post it back to the database? This would not be a good use case for SSRS. You'd be better off doing this in ASP.net or whatever language you prefer.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • yes, I mean to input data in report and update database by this input by ssrs.

    it is possible ?

  • Again, this is not a good use case for Reporting Services, I suppose it could theoretically be done by passing the parameters to some stored procedures but it's just not something you want to do. There are WAY better ways to accomplish this.

    You're best bet would be to look into ASP.net or another language actually meant for the purpose you are looking to accomplish, that is to create an application for data entry. SSRS is meant for creating reports, in other words displaying reports based on existing data, not gathering new data.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • ok, thank's a lot. I understand what you are trying to tell me.

    u will look for another solution.

  • yes, thank's.

    I create this stored procedure below, but I get this error when I try to update the properties :

    property cant be add. property 'Domain' already exists for 'object specified'.

    the code :

    CREATE PROCEDURE tiy1909 @domain nvarchar(100),@db_name nvarchar(100)

    AS

    declare @STR nvarchar(100)

    if 'Domain' in (select name from sys.extended_properties)

    BEGIN

    set @STR = 'USE '+@db_name+'; EXEC sp_updateedextendedproperty @name=''Domain'',@value='''+@domain+''';'

    EXEC sp_executesql @STR

    END

    ELSE BEGIN

    set @STR = 'USE '+@db_name+'; EXEC sp_addextendedproperty @name=''Domain'',@value='''+@domain+''';'

    EXEC sp_executesql @STR

    END

    mybe someone can help me, thanks

  • If this is a different issue (i.e. not relating to SSRS 2008 Development) I would suggest creating another thread in the appropriate forum. Be sure to read the first link in my signature below for all of the information to provide in order for you to receive the best help in the most timely manner. In other words, if you're having issues with the below stored procedure make sure you explain what you are trying to do and why as someone may have a better technique for achieving the same results.

    By creating a separate thread in the appropriate forum you will ensure that more people will see it rather than burying it in a totally unrelated request.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • aviad.co1 (6/7/2010)


    yes, thank's.

    I create this stored procedure below, but I get this error when I try to update the properties :

    property cant be add. property 'Domain' already exists for 'object specified'.

    the code :

    CREATE PROCEDURE tiy1909 @domain nvarchar(100),@db_name nvarchar(100)

    AS

    declare @STR nvarchar(100)

    if 'Domain' in (select name from sys.extended_properties)

    BEGIN

    set @STR = 'USE '+@db_name+'; EXEC sp_updateedextendedproperty @name=''Domain'',@value='''+@domain+''';'

    EXEC sp_executesql @STR

    END

    ELSE BEGIN

    set @STR = 'USE '+@db_name+'; EXEC sp_addextendedproperty @name=''Domain'',@value='''+@domain+''';'

    EXEC sp_executesql @STR

    END

    mybe someone can help me, thanks

    I don't see how that could ever work. The first if in the SP checks in the CURRENT db for the domain value. Then you add possibly in another DB. That's most likely why this is failing with the message that the property already exists and that you can't create it again.

  • you righ't, I fix it but I still have a error - property cant be updated or deleted.

    property 'Domain' does not exist for 'object specified'.

    this the new code :

    CREATE PROCEDURE yyeess51 @domain nvarchar(100),@db_name nvarchar(100)

    AS

    declare @STR nvarchar(100)

    declare @str1 nvarchar(100)

    set @STR = 'USE '+@db_name+';'

    EXEC sp_executesql @STR

    if 'Domain' in (select name from sys.extended_properties)

    set @str1 = 'USE '+@db_name+';EXEC sp_updateextendedproperty @name=''Domain'',@value='''+@domain+''';'

    else set @str1 = 'USE '+@db_name+';EXEC sp_addextendedproperty @name=''Domain'',@value='''+@domain+''';'

    EXEC sp_executesql @str1

    thank's, you help me a lot.

  • Still can't work. Exec basically open a new connection with new spid based on the current context. Once that exec is over the use is.. well useless.

    The whole if / exec needs to be in a single dynamic sql.

    Moreover when debugging such scripts, you can skip the exec line and use print. Then copy the print statement back the SSMS and try to execute it. If it works there, it'll most likely also work in the exec form... assuming permissions are ok (the user calling the proc must have direct permissions to the tables and procs used in the exec... one more reason why it's not the best way to do things.)

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply