显示标签为“current”的博文。显示所有博文
显示标签为“current”的博文。显示所有博文

2012年3月29日星期四

Display a report in fullscreenmode

Hello,
is it possible to open a report in fullscreenmode automatically? Perhaps there might be a http parameter?

Current view:

Now a click on the button on the right side. This is the view i want to see when i open a report.

Did anyone have an idea how i can achieve my goal?

Thanks for your help!
Christian Niehaves

Use the url http://servername/ReportServer instead of http://servername/Reports|||Great.
Thanks for your help.

Disk Subsystem Problem during snapshot

We have set up a new SQL environment that has to replace our current SQL
environment. On our current environment we apply a snapshot every night from
our production database (the production database is hosted on another
environment). This means every night approximately 15GB is being copied to
the subscriber. It takes a long time to do this (3+ hours), but is not a
problem in our environment.
Exactly the same snapshot has to be applied on our new SQL environment. In
this environment we are having serious problems with our Disk Subsystem when
applying the snapshot. In the new environment we use a shared HP MSA1000 Disk
System. When applying the snapshot, the load is so high on the MSA1000 that
it can’t handle all the requests no more. This results in a crash of SQL
server (SQL can’t find the tempdb anymore) and other systems that use the
MSA1000 (two more servers, so three in total) are having problems with the
disks also (event id 51).
We’ve contacted HP and Microsoft and the conclusion will probably be that
the load generated by applying the snapshot is to high for the MSA1000.
Microsoft’s explanation about how this can be, knowing that the exact same
process runs on an old environment, is very reasonable (although it’s still
hard to believe that old hardware operates better under high load than new
advanced hardware).
I’d like to know what the opinion from you all is about applying a snapshot
every night to a subscriber, which involves copying approximately 15GB of
data. Should it be no problem to this, or is it very uncommon to do this
because of hardware limitations? Is it normal that the MSA1000 has problems
of this kind with this, or should it be able to handle the load (should it
result in disks that cannot be contacted anymore or should it just perform
very slow)?
Your opinion is very much appreciated!
Kind regards,
Jan Martijn Schuur
"Martijn" schrieb:
...
> I’d like to know what the opinion from you all is about applying a snapshot
> every night to a subscriber, which involves copying approximately 15GB of
> data. Should it be no problem to this, or is it very uncommon to do this
> because of hardware limitations?
15 GB is a large amount of data for a nightly snapshot. Why don't you use
the incremental transactional replication?
Your other problems with this are not familiar to me. Sorry.

2012年2月24日星期五

Disable triggers only for active sessions

Hey,

is it possible to disable all DML triggers for the current session only?
This is for manual data correction sessions where no trigger should be fired but all other user connection still should have active triggers.

Cheers,I don't think you can do this without modifying your trigger. You can use SUSER_NAME() function inside your trigger and if it matches with the login user bypass the execution.

to be specific.

The first line of trigger code will be if SUSER_NAME() = 'Manuel' return|||I can second that, you will have to implement some additional logic to make this possible.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

2012年2月19日星期日

Disable Trigger rules

I had created several Trigger rules in current database and it will be
active on 1st Nov,2005,
Can I disable them now ? and then make them active on that target date '
Thanks a lotThe only way to disable a trigger is to drop it (or comment out the
T-SQL code in it so it does nothing). If I were you I'd script them out
to a file (with SQLEM), drop them (thereby "disabling" them) and then
schedule the SQL script in the file containing all the trigger code to
run via SQLAgent on Nov 1st (thereby "re-enabling" them).
*mike hodgson*
blog: http://sqlnerd.blogspot.com
Agnes wrote:

>I had created several Trigger rules in current database and it will be
>active on 1st Nov,2005,
>Can I disable them now ? and then make them active on that target date '
>Thanks a lot
>
>|||Thanks Mike, I try your method , script it out. (however, it seems I must sc
ript the table structure too.).Any Simple method, i can script trigger rule
only , and the drop them all '
Please be kind to provide some sample .. Thanks in advance. (Today is my 4th
day working about Trigger rule)
"Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> '?:%23B7WU132FHA.279
6@.tk2msftngp13.phx.gbl...
The only way to disable a trigger is to drop it (or comment out the T-SQL co
de in it so it does nothing). If I were you I'd script them out to a file (
with SQLEM), drop them (thereby "disabling" them) and then schedule the SQL
script in the file containing all the trigger code to run via SQLAgent on No
v 1st (thereby "re-enabling" them).
mike hodgson
blog: http://sqlnerd.blogspot.com
Agnes wrote:
I had created several Trigger rules in current database and it will be
active on 1st Nov,2005,
Can I disable them now ? and then make them active on that target date '
Thanks a lot|||Hey you have soemthing called
ALTER TABLE ENABLE/DISABLE TRIGGER Read in BOL
If you want to do it for all tables, use
sp_Msforeachtable "ALTER TABLE '?' DISABLE TRIGGER"
Regards
R.D
--Knowledge gets doubled when shared
"Agnes" wrote:

> Thanks Mike, I try your method , script it out. (however, it seems I must
script the table structure too.).Any Simple method, i can script trigger rul
e only , and the drop them all '
> Please be kind to provide some sample .. Thanks in advance. (Today is my 4
th day working about Trigger rule)
> "Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> '?:%23B7WU132FHA
.2796@.tk2msftngp13.phx.gbl...
> The only way to disable a trigger is to drop it (or comment out the T-SQL code i
n it so it does nothing). If I were you I'd script them out to a file (with SQLEM),
drop them (thereby "disabling" them) and then schedule the SQL script in the file c
ont
aining all the trigger code to run via SQLAgent on Nov 1st (thereby "re-enabling" them).[co
lor=darkred]
> --
> mike hodgson
> blog: http://sqlnerd.blogspot.com
>
> Agnes wrote:
> I had created several Trigger rules in current database and it will be
> active on 1st Nov,2005,
> Can I disable them now ? and then make them active on that target date '
> Thanks a lot
>
>[/color]|||> The only way to disable a trigger is to drop it (or comment out the
> T-SQL code in it so it does nothing).
This is simply not true. Disabling or enabling a trigger is done through the
ALTER TABLE statement.
- to disable a trigger:
ALTER TABLE <table>
DISABLE TRIGGER <trigger>
- to enable a trigger:
ALTER TABLE <table>
ENABLE TRIGGER <trigger>
More here:
http://msdn.microsoft.com/library/d...br />
3ied.asp
ML|||Well you learn something new every day (I don't claim to know
everything). Thanks for the tip - that one's filed away in permanent
cache now. You know, over 10 years working with MSSQL and I'd never
noticed that clause in the ALTER TABLE statement.
*mike hodgson*
blog: http://sqlnerd.blogspot.com
R.D wrote:

>Hey you have soemthing called
>ALTER TABLE ENABLE/DISABLE TRIGGER Read in BOL
>If you want to do it for all tables, use
>sp_Msforeachtable "ALTER TABLE '?' DISABLE TRIGGER"
>
>|||I myself was reluctant to use these two methods at first since QA does not
recognize ENABLE and DISABLE as reserved keywords. :)
ML|||Maybe my brain's just not wired correctly, but wouldn't it make more
sense to have the ENABLED/DISABLED clause as part of the ALTER TRIGGER
statement rather than the ALTER TABLE statement? Something like "ALTER
TRIGGER MyTrig ON me.MyTable DISABLE"
*mike hodgson*
blog: http://sqlnerd.blogspot.com
ML wrote:

>I myself was reluctant to use these two methods at first since QA does not
>recognize ENABLE and DISABLE as reserved keywords. :)
>
>ML
>|||Quite the opposite! Wouldn't it make much more sense if triggers were added
to the objects:
alter table / view <name>
add trigger <trigger_name>
:)
After all - each trigger can only belong to a single table/view...
ML|||True, a trigger can only belong to a single table/view. But ALTER TABLE
is what you use to change the behaviour of an existing trigger (trigger
code, encryption, etc.), so it makes more sense to me that to change an
"attribute" of a trigger, which I would consider its "enabled/disabled"
status to be, you'd use ALTER TRIGGER.
Moot point anyway - purely a hypothetical, but I think the way they've
gone with T-SQL in SQL 2005 is better (with DISABLE TRIGGER being a DDL
statement all of its own).
*mike hodgson*
blog: http://sqlnerd.blogspot.com
ML wrote:

>Quite the opposite! Wouldn't it make much more sense if triggers were added
>to the objects:
>alter table / view <name>
> add trigger <trigger_name>
>:)
>After all - each trigger can only belong to a single table/view...
>
>ML
>

2012年2月17日星期五

disable implicit casting

Is there a way do disable/disallow implicit casting in Sql Server 2000?

Say for example:

if ' ' = 0 select getdate()

This wil print out the current date and time.

But ' ' (a string, varchar, whatever) is not the same type as 0 (say, int). Implicit casting is nice, but is there also an off switch?

I've looked at the book Itzik Ben-Gan (T-SQL Programming). On the paragraph about implicit conversion he doesn't cite any way to switch it off. He also suggests that in some case may be useful to explicit cast data to sql_variant and reports the following example, that maybe can suggest a workaround:

select
case
when 1>1 then 10
when 1=1 then 'abc'

when 1<1 then 10
end;

select

case

when 1>1 then cast(10 as sql_variant)

when 1=1 then cast('abc' as sql_variant)

when 1<1 then cast(10 as sql_variant)

end;

MS help says also that "Implicit conversions are not visible to the user", so I guess there's no way to disable it.

Take a look also at the following docs:
http://msdn2.microsoft.com/en-us/library/ms191530.aspx
http://msdn2.microsoft.com/en-us/library/ms190309.aspx|||

Thanks.

It's really weird. I would have suspected an feature like 'option strict' like there is in VB (and for a good reason). It's a shame it's not there in T-SQL.

2012年2月14日星期二

Disable a task in the current package programmatically?

Hi,

I have a package comprising a number of Data Flow Task steps, to import various tables of data from some Access databases into SQL Server. The name of some of these Access databases will change depending on the date, e.g. last year's data is currently in a database called "2005data.mdb". At year end this will be superseded by "2006data.mdb". The Access databases are within a 3rd party system so I have no control over the file names.

I have a Script Task that checks the current date, and changes the name of an Access database in the connection string to reflect last year's date. But to complicate matters, last year's file might not exist.

So the Script Task checks whether the file name exists. If not, I would like to disable the Task that uses this connection. But how do I reference a task within the package that contains my Script Task, by name, to set the Disabled attribute to true?

I want to do something like CurrentPackage.Tasks("MyDataFlowTask").Disabled = True.

I would also welcome alternative suggestions for how to achieve this.

Many thanks,

Keith.

You cannot reference inwards within a package, so you cannot reference a task. The task must reference the value. The way to do this is to set a variable, and use a property expression that uses that variable value. So you would set a variable, DisableMyTask as true to false in the script then set the property expression on the task's Disable property to that variable, "@.DisableMyTask".

I would however be careful using the Disable property, as the evaluation can be done before you set the variable, so it is too late. A better way to do this is to use an expression on Workflow. Have a constraint leading to your task, and then just add the variable as the test, or rather the negative, so that the constraint is only satisfied when the variable is false. If you have no preceding task to anchor the constraint, just use a sequence container. It will act as an anchor, but do nothing else.

|||

Keith,

You can also add an Expression to the constraint from your Script Task that is modifying the connection string. By doing so you can control the flow without having to enable/disable the invalid tasks.

Here's a link on how to add expressions to a precendence constraint: http://msdn2.microsoft.com/en-us/library/ms140040.aspx

Cheers,
Patrik

|||

Hi,

Thanks for the replies. I have tried adding expressions to the precedence constraints, but it is not working correctly.

I originally had 7 Tasks, with a simple precedence constraint of Success between one and the next. I've now added an expression based on a variable, and changed the precedence constraint to "Constraint and Expression", but with this change, steps 5 to 7 no longer execute. They are still validated, but do not Start.

In simplistic terms, the logic I have added is:

After Task 3, if Success and (@.boolPCStatsLastYearExists) then Execute Task 4.

After Task 4, if Success, execute Task 5.

After Task 3, if Success and (@.boolPCStatsLastYearExists = False) then Execute Task 5.

So, whether the boolean value @.boolPCStatsLastYearExists is True or False, Task 5 should be executed. In fact I think it is set to True, because Task 4 executes and creates rows in the database, so it appears Task 4 is executing but Task 5 isn't.

I am developing on my local machine, but cannot run locally (I get an error on the first Data Flow Task), because the SQL database is on a server. So I am deploying to the server and running there.

Can you advise how I should get debugging information to indicate what happens after Task 4 executes, and why Task 5 isn't reached?

Many thanks,

Keith.

|||

To debug stuff, use the debugger. Creating a mock DB on your local machine would be a good idea.

Sounds like you have two constraints leading to task 5, but they follow different, mutually exclusive execution paths. So you will never satisfy both constraints in a single execution, correct? If so, have you turned the Or logic option on for those constsraints? It is in the constraint UI, or the LogicalAnd property of the constraint, set it to false.

|||

Hi again,

Thanks for that. I had left the default setting (AND) on the constraints. Changing all the constraints where 2 constraints affect one task, led to some progress.

Tasks 1 - 6 now execute fine. But Task 7 never executes.

The constraints on it are:

From Task 5, Success AND @.boolPCFDR1LastYearExists = False

OR

From Task 6, Success.

The first of these conditions should be met, as Task 5 succeeds and writes data, and the boolean is set to False by Task 1 (the Script task), which I can verify in the debugger.

I would greatly appreciate any further suggestions. However, I suspect I will now need to install SQL Server on my already overloaded laptop and recreate the server database locally, so that I can debug. But having looked at the debugger, I am not confident I will have a sufficiently granular view to identify the problem. I'll report back!

Thanks for all your help so far,

Keith.

|||

Hi,

OK, I've installed SQL Server locally, copied the database to it, and changed my connection to point to the local database. The same error occurs, and I don't see how to use the debugger to help me resolve it.

I can put a stop in Step 5 Post-Execute, but I can't do any more than verify that the boolean is set to False as expected. What can I do to identify why the processor does not proceed to execute Step 7?

Thanks,

Keith.

|||

Solved! (Sort of). I've had a problem with conditions on a precedence constraint. I can set a condition of @.myBooleanVariable, and it executes correctly, only when the variable is set to true. However, I can't find a syntax to say execute when this boolean is False. I tried the obvious NOT @.myBooleanVariable, but this does not pass the syntax check. @.myBooleanVariable = False passes the syntax check, but crucially, does not execute. I've not found another syntax that is accepted.

So reluctantly, I created 2 new variables, set them to the boolean opposite of the 2 existing variables, and used them in my "negative" conditions. So all my conditions on Precedence Constraints now comprise just the name of a boolean variable, prefixed with @..

Thanks,

Keith.

|||

Keith,

In the expressions not is represented with ! and equivalency is tested with ==. This should help you remove the additional variable.

Cheers,
Patrik