Showing posts with label automatically. Show all posts
Showing posts with label automatically. Show all posts

Tuesday, March 27, 2012

Extra "blanks" in the cloumn field

When I enter a data in a table, SQL Server automatically completes the data with blanks up to length of column.

this happens in a web form also in Management Studi?o,

Whan am I doing wrong ?

does Collation have anything with it ?

SQL Server 2005 / Developer Edition

It sounds like you are using the char data type. SQL Server will automatically pad this with spaces as it is a fixed number characters. Use varchar instead.|||

thanks for your help,

now it is not padding.

Wednesday, March 7, 2012

Expression as a default value problem..

I want to automatically run a report every day of the week. This isn't a problem. However I want the users to be able to run the
report whenever they feel like too. Can I put expressions in the default value entry? They don't seem to generate anything...
Here is the value I want to put in..
=CDate(IIF(datepart("w", Today) = 2, dateadd("d", -2, Today), dateadd("d", -1, Today)).ToString)
Can anyone see anything wrong with this?
Thanks
ScottWhere are you settting this expression? This should work if you pull up
Report Parameters dialog in report designer, enter this expression in
Default -> Non-queried textbox, and preview it (I just tried it to confirm.)
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Scott Meddows" <scott_meddows_no_spm@.tsged-removeme.com> wrote in message
news:u1j3alvWEHA.1888@.TK2MSFTNGP11.phx.gbl...
> I want to automatically run a report every day of the week. This isn't a
problem. However I want the users to be able to run the
> report whenever they feel like too. Can I put expressions in the default
value entry? They don't seem to generate anything...
> Here is the value I want to put in..
> =CDate(IIF(datepart("w", Today) = 2, dateadd("d", -2, Today),
dateadd("d", -1, Today)).ToString)
> Can anyone see anything wrong with this?
> Thanks
> Scott
>

Sunday, February 19, 2012

Exporting to Plain Text

Has anyone found a way to export a report to plain text? I need to be able to
do this automatically when the report is run via a schedule on the server.
Help!
RickYou need to have a custom rendering solution. This link is quite interesting
about custom rendering.
http://msdn.microsoft.com/msdnmag/issues/05/02/CustomRenderers/
Amarnath
"RLS" wrote:
> Has anyone found a way to export a report to plain text? I need to be able to
> do this automatically when the report is run via a schedule on the server.
> Help!
> Rick

Wednesday, February 15, 2012

Exporting stored procedures

Hello!
I look for a way to export the stored procedures from a database
automatically. The GUI way is "generate SQL script", but I want to do it via
script, or an API.
Thanks!
RoeeIt is all in the SQL-DMO API.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Roee Friedman" <roee@.monosphere.com> wrote in message
news:bnl2d1$12c9cd$1@.ID-200860.news.uni-berlin.de...
> Hello!
> I look for a way to export the stored procedures from a database
> automatically. The GUI way is "generate SQL script", but I want to do it via
> script, or an API.
> Thanks!
> Roee
>|||Hi,
You can use DTS packages to copy objects to destination.
The task name is "Copy SQL Server Objects Task" , in the copy tab you can
select all stored procedures.
Thanks
Hari
MCDBA
"Roee Friedman" <roee@.monosphere.com> wrote in message
news:bnl2d1$12c9cd$1@.ID-200860.news.uni-berlin.de...
> Hello!
> I look for a way to export the stored procedures from a database
> automatically. The GUI way is "generate SQL script", but I want to do it
via
> script, or an API.
> Thanks!
> Roee
>|||"Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:eOMJaLSnDHA.1728@.TK2MSFTNGP09.phx.gbl...
> Hi,
> You can use DTS packages to copy objects to destination.
> The task name is "Copy SQL Server Objects Task" , in the copy tab you can
> select all stored procedures.
Although this will only work if the source and destination are both SQL
Servers
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.530 / Virus Database: 325 - Release Date: 22/10/2003|||Here's an example of scripting all the stored procedures in a database with
Perl and SQL-DMO. Save the following code in a file, say, named scriptSP.pl:
################## Being script
# tested with ActivePerl 5.6.1, Binaray Build 631
use strict;
use Getopt::Std;
use Win32::OLE 'in';
use Win32::OLE::Const 'Microsoft SQLDMO'; # import the SQL-DMO symbolic
constants
my %opts;
getopts('S:d:o:', \%opts); # Get the command line arguments
my ($serverName, $dbName, $output) = ($opts{S}, $opts{d}, $opts{o});
# Check whether the required command line arguments are specified
(defined $serverName && defined $dbName && defined $output)
or printUsage();
# Create a SQLDMO SQLServer object
my $server = Win32::OLE->new('SQLDMO.SQLServer') or
die "***Err: could not create SQLDMO object.\n";
$server->{LoginSecure} = 1; # trusted connection
# Connect to the SQL instance via trusted connection
$server->connect($serverName);
! Win32::OLE->LastError() or
die "***Err: SQLDMO could not connect to $serverName.\n";
# Get the SQLDMO Database object
my $db = $server->Databases($dbName);
# Loop through the StoredProcedures collection to script each stored
procedure
foreach my $obj (in($server->Databases($dbName)->StoredProcedures())) {
$obj->Script(SQLDMOScript_Default | SQLDMOScript_AppendToFile |
SQLDMOScript_IncludeHeaders | SQLDMOScript_Drops |
SQLDMOScript_ToFileOnly,
$output); # the SQL script goes to this
file
}
# Clean up
$server->disconnect();
$server->DESTROY();
sub printUsage {
print << '--Usage--';
Usage:
cmd>perl scriptSP.pl -S <SQL instance> -d <database name> -o <output
file>
--Usage--
exit;
} # printUsage
################# End script
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Roee Friedman" <roee@.monosphere.com> wrote in message
news:bnl2d1$12c9cd$1@.ID-200860.news.uni-berlin.de...
> Hello!
> I look for a way to export the stored procedures from a database
> automatically. The GUI way is "generate SQL script", but I want to do it
via
> script, or an API.
> Thanks!
> Roee
>