Tuesday, March 27, 2012
Change image properties at runtime
I'm using Reporting Services for SQL2K. My report will need to dynamically
call a custom assembly for each row in a dataset, and then show the image
file that the custom assembly creates. I was thinking of using an Image
control in the report and then changing the path to the image file at
runtime. But I can not figure out how to access the image1.Value property.
Any tips on this or perhaps an alternative solution?
TIA
JonasI found the answer, and it was very easy ;-)
When the control is selected in the Report Designer, it it possible to edit
the properties as usual. The property for Value can also use an Expression,
and voila, this can point to a variable which contains a dynamically created
path.
Brgds
Jonas
"Jonas" <Jonas@.nospam.pl> wrote in message
news:%23z53z3cHGHA.240@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I'm using Reporting Services for SQL2K. My report will need to dynamically
> call a custom assembly for each row in a dataset, and then show the image
> file that the custom assembly creates. I was thinking of using an Image
> control in the report and then changing the path to the image file at
> runtime. But I can not figure out how to access the image1.Value property.
> Any tips on this or perhaps an alternative solution?
> TIA
> Jonas
>
>
Wednesday, March 7, 2012
Change "from" portion of the email when calling sp_send_dbmail?
Is this possible?
I believe the only way to do this is to use different profiles|||Take a look at xp_smtp_sendmail http://www.sqldev.net/xp/xpsmtp.htm.|||To enhance Euan's reply refer to - http://www.sql-server-performance.com/da_email_functionality.asp & http://www.sqlservercentral.com/columnists/cBunch/introtodatabasemailinsql2005.asp links.|||
Your answer is not very practical when you have hundreds of users.
In the older SQL Server 2000 we used
Code Snippet
exec @.rc = master.dbo.xp_smtp_sendmail
@.FROM = @.in_FROM_ADDRESS,
@.FROM_NAME = @.in_FROM_NAME,
@.TO = @.in_TO_ADDRESS,
@.CC = @.in_CC,
@.BCC = @.in_BCC,
@.priority = @.in_priority,
@.subject = @.in_subject,
@.type = @.in_type,
@.message = @.in_message
Which had the first paramater @.From and the second one was @.From_Name.
Both of which are now gone in the new send dbmail
Code Snippet
exec @.rc = msdb.dbo.sp_send_dbmail
@.profile_name = 'MIS',
@.recipients = @.in_TO_ADDRESS,
@.copy_recipients = @.in_CC,
@.blind_copy_recipients = @.in_BCC,
@.importance = @.in_priority,
@.subject = @.in_subject,
@.body = @.in_message
The resulting emails are coming from whatever you set the Profile name to be. As you would by default set the profile to be generic, something like 'MIS Server Mailer' or whatever your application name is. Hense all the mails now come from this generic user.
This is a problem, and MS should extend the DB Mail to include this rather simple option.
Change "from" portion of the email when calling sp_send_dbmail?
Is this possible?
I believe the only way to do this is to use different profiles|||Take a look at xp_smtp_sendmail http://www.sqldev.net/xp/xpsmtp.htm.|||To enhance Euan's reply refer to - http://www.sql-server-performance.com/da_email_functionality.asp & http://www.sqlservercentral.com/columnists/cBunch/introtodatabasemailinsql2005.asp links.|||
Your answer is not very practical when you have hundreds of users.
In the older SQL Server 2000 we used
Code Snippet
exec @.rc = master.dbo.xp_smtp_sendmail
@.FROM = @.in_FROM_ADDRESS,
@.FROM_NAME = @.in_FROM_NAME,
@.TO = @.in_TO_ADDRESS,
@.CC = @.in_CC,
@.BCC = @.in_BCC,
@.priority = @.in_priority,
@.subject = @.in_subject,
@.type = @.in_type,
@.message = @.in_message
Which had the first paramater @.From and the second one was @.From_Name.
Both of which are now gone in the new send dbmail
Code Snippet
exec @.rc = msdb.dbo.sp_send_dbmail
@.profile_name = 'MIS',
@.recipients = @.in_TO_ADDRESS,
@.copy_recipients = @.in_CC,
@.blind_copy_recipients = @.in_BCC,
@.importance = @.in_priority,
@.subject = @.in_subject,
@.body = @.in_message
The resulting emails are coming from whatever you set the Profile name to be. As you would by default set the profile to be generic, something like 'MIS Server Mailer' or whatever your application name is. Hense all the mails now come from this generic user.
This is a problem, and MS should extend the DB Mail to include this rather simple option.
Chain transact sql scripts
I have two Transact SQL scripts and I want to call the second script from the first –
is this possible in SQL server 2005?
I am trying to do a port from Oracle (where this is possible) but cannot find the mechanism to do so in SQL Server.
Eg if Script1.sql is
BEGIN
PRINT (‘Inside Script1’)
//Invoke Script2.sql – how do I do this?
END
where Script2.sql is
BEGIN
PRINT (‘Inside Script2’)
END
When I execute Script1.sql - I need it to print both 'Inside Script2' and 'Inside Script1'
You can do this using the :r command if you invoke the script using the new SQLCMD command-line utility. It also has other script pre-processing features. You can take a look at the Books Online topic at link below:
http://msdn2.microsoft.com/en-us/library/ms162773(SQL.90).aspx
|||We can use the :r option inside sqlcmd - but was looking for Transact SQL support (without using xp_cmdshell to spawn "sqlcmd" inside a larger script) - Inside a Oracle pl/sql script, we use "@.<scriptname> from a enclosing script" - was looking for similar functionality in Transact SQL|||I would suggest the best way would be to place the code inside two stored procedures, and call one from the other.
HTH
|||shuges is right
store procedure can call another sp
using the exec "spname" syntax
also sql queries can be nested so it is possible to
rewrite two sps into one.
moreover you can also make use of functions
|||The :r SQLCMD command is the equivalent of @. command in SQLPLUS. These are client-side features not part of the TSQL or PL/SQL language.