Showing posts with label working. Show all posts
Showing posts with label working. Show all posts

Thursday, March 29, 2012

datatype problem

Hi Everyone,

In C# file:

bool abc; (it is working)

But in sql file: (bool is not working. What datatype should use for bool in the sql file?)

CREATE TABLEsb_payment_history (

sb_dispensing bool NULL <================ not working because bool is not known.

)

GO

Thanks,

May

You should use the bit datatype in your SQL table.

Tuesday, March 27, 2012

Datasource Change HELP!

I am working in a dev environment. My report uses 20 different datasets but
they all point to the same datasource. I am moving from Dev to a UAT
environment which points to a different DB. Is there a way to change the
datasource for all 20 datasets from DevDB to UATDB at once or am I stuck with
going in and changing all the datasources for each of the datasets one by one?
Thanks in advance
OSTry opening XML <F7> and doing a find/replace on the DB name. This is
assuming that the new datasource is already defined in the solution and the
table names are the same.
"OriginalStealth" wrote:
> I am working in a dev environment. My report uses 20 different datasets but
> they all point to the same datasource. I am moving from Dev to a UAT
> environment which points to a different DB. Is there a way to change the
> datasource for all 20 datasets from DevDB to UATDB at once or am I stuck with
> going in and changing all the datasources for each of the datasets one by one?
> Thanks in advance
> OS|||Hi,
Have you used as a "shared resources" for all your reports? then it should
not be a problem since you need to just change the database and user
name/password etc.. details at your datasource and you will be up and
running.
Amarnath
"OriginalStealth" wrote:
> I am working in a dev environment. My report uses 20 different datasets but
> they all point to the same datasource. I am moving from Dev to a UAT
> environment which points to a different DB. Is there a way to change the
> datasource for all 20 datasets from DevDB to UATDB at once or am I stuck with
> going in and changing all the datasources for each of the datasets one by one?
> Thanks in advance
> OS|||William,
This really helped me! Thanx a bunch!
OS
"William" wrote:
> Try opening XML <F7> and doing a find/replace on the DB name. This is
> assuming that the new datasource is already defined in the solution and the
> table names are the same.
> "OriginalStealth" wrote:
> > I am working in a dev environment. My report uses 20 different datasets but
> > they all point to the same datasource. I am moving from Dev to a UAT
> > environment which points to a different DB. Is there a way to change the
> > datasource for all 20 datasets from DevDB to UATDB at once or am I stuck with
> > going in and changing all the datasources for each of the datasets one by one?
> >
> > Thanks in advance
> > OS|||How can we programatically change the DB name?
Or
Change them dynamically in the URL?
Prad
Amarnath wrote:
> Hi,
> Have you used as a "shared resources" for all your reports? then it should
> not be a problem since you need to just change the database and user
> name/password etc.. details at your datasource and you will be up and
> running.
> Amarnath
>
> "OriginalStealth" wrote:
> > I am working in a dev environment. My report uses 20 different datasets but
> > they all point to the same datasource. I am moving from Dev to a UAT
> > environment which points to a different DB. Is there a way to change the
> > datasource for all 20 datasets from DevDB to UATDB at once or am I stuck with
> > going in and changing all the datasources for each of the datasets one by one?
> >
> > Thanks in advance
> > OS|||What you should be doing is to have a shared datasource. The first time you
deploy the datasource is deployed too. Then you go to the Report Manager and
change the datasource to point to the production data. From then on when you
deploy the default is that the datasource is not overwritten so you only
need to do this once.
So there should only be one datasource that you have to change once in this
process.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<pradeepmm@.gmail.com> wrote in message
news:1144344167.425837.308400@.u72g2000cwu.googlegroups.com...
> How can we programatically change the DB name?
> Or
> Change them dynamically in the URL?
> Prad
> Amarnath wrote:
>> Hi,
>> Have you used as a "shared resources" for all your reports? then it
>> should
>> not be a problem since you need to just change the database and user
>> name/password etc.. details at your datasource and you will be up and
>> running.
>> Amarnath
>>
>> "OriginalStealth" wrote:
>> > I am working in a dev environment. My report uses 20 different
>> > datasets but
>> > they all point to the same datasource. I am moving from Dev to a UAT
>> > environment which points to a different DB. Is there a way to change
>> > the
>> > datasource for all 20 datasets from DevDB to UATDB at once or am I
>> > stuck with
>> > going in and changing all the datasources for each of the datasets one
>> > by one?
>> >
>> > Thanks in advance
>> > OS
>|||Is there any way to change the datasource for a report on an
execution-by-exection basis?
I have a situation where there are a large numbre of databases and
users need to be able to execute a single report against any of the
databases.
Is there a way to supply the database connection string to the report
when it is executed?sql

Thursday, March 22, 2012

Dataset Parameters and Expressions in Report Connection String

I am working with RS 2005 and have run into a problem with passing a server and database name as parameters into a server report.

Here's what the connection string looks like in these reports:

="Data Source = " & Parameters!ServerName.Value & ";Initial Catalog=" & Parameters!DBName.Value

I have default values set for both parameters, so testing usually works fine also. If I run a report with "normal" parameters or no parameters, the report runs fine with the supplied connection string.

The problem occurs when I try to add a parameter to the report that uses a dataset to populate a list of choices. I get the following error when trying to run a report in this situation:

"Error during processing of the ConnectString expression of datasource 'dbConnection'"

I don't get any build errors, just the message above in the report canvas.

Any direction/assistance anyone can provide would be greatly appreciated.. thanks in advance.

Very simple solution, it turns out... just make sure the ServerName and DBName parameters appear above all other parameters in the report definition.

Wednesday, March 21, 2012

dataset isn't showing

SQL/RS 2K, VS .Net 2003 - several single resultset/dataset reports working
just fine, finally got some multiple-resultset/dataset reports working very
well, too. today, however, i am creating a new one that isn't working, and i
can't yet determine why.
i have 5 different datasets so far, each are command type text, each field
presents the data just fine in the Data tab. I've created tables in the
Layout tab for each dataset, and dragged/dropped the fields into each
accordingly. When I go into the Preview tab, each dataset/table is visible
only intermittently' Meaning, I'm in Preview, and 3 of the five
datasets/tables are showing data, the other two are blank. Now, if i hit
refresh, only two are showing data... AND one of them is one that wasn't
showing data a moment ago.
I'm setting this thing up just like the three i did yesterday, which are
working just fine.
Can anybody provide any direction on this? It's very, very important, and I
do appreciate any assistance.
--
LynnWeird. I haven't seen this before. I suggest trying to deploy and see if
this is something only from the development environment.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Lynn" <Lynn@.discussions.microsoft.com> wrote in message
news:278379C7-06BF-4726-B3DA-18EE50B6EAFA@.microsoft.com...
> SQL/RS 2K, VS .Net 2003 - several single resultset/dataset reports working
> just fine, finally got some multiple-resultset/dataset reports working
> very
> well, too. today, however, i am creating a new one that isn't working,
> and i
> can't yet determine why.
> i have 5 different datasets so far, each are command type text, each field
> presents the data just fine in the Data tab. I've created tables in the
> Layout tab for each dataset, and dragged/dropped the fields into each
> accordingly. When I go into the Preview tab, each dataset/table is
> visible
> only intermittently' Meaning, I'm in Preview, and 3 of the five
> datasets/tables are showing data, the other two are blank. Now, if i hit
> refresh, only two are showing data... AND one of them is one that wasn't
> showing data a moment ago.
> I'm setting this thing up just like the three i did yesterday, which are
> working just fine.
> Can anybody provide any direction on this? It's very, very important, and
> I
> do appreciate any assistance.
> --
> Lynn

Dataset Filtering Not Working

I am trying to filter data at the dataset level after it is returned.

However, the filters tab on in the Dataset window does not appear to work correctly.

I have tried the following expressions:

Expression Operator Value

=(Fields!IdLog.Value = Parameters!Id_Log.Value) = =True

=Fields!IdLog.Value = =Parameters!Id_Log.Value

When I rerun my dataset query, the entire dataset is returned, instead of the filtered dataset. This same behavior occurs if I try to run the report itself.

I do not understand why the filtering does not occur.

Any help would be greatly appreciated.

To get maximum performance with filtering its the best to build the parameter into the SQL-Query:

="select your_colums from your_table where ID='" & Parameters!Id_Log.Value & "'"

I never tried something different, because its waste of resources to retrieve 1000records from a database and filter out 999 of them..

|||

BenniG,

Thank you for your comment. However, I am try to filter the results that are returned from a Web Service, and therefore, I cannot specify the SQL Statement used to query the database.

|||

I tried the filter-tab:

=Fields!ID.Value = =Parameters!ID.Value

works if both fields have the same datatype, if one is a string and one an integer I get an error.. Maybe you have to change the datatype for the Parameter?
I think the filter has no effect on the !-Icon in datasets, but in my case it worked in preview mode..

DataSet - Should be easy but I dont know how

I am working on a WebMatrix ASP project. I have a query that returns a System.Data.DataSet but I don't know how to assign the DataSet to a variable so that I can run some validation tests on it.

This is what I have so far...What I want to do is assign the dataset to a variable and to see if it is NULL or Not. I don't how? Any help would be awesome.

Sub Button1_Click(sender As Object, e As EventArgs)
?? = MyQueryMethod(txtPhone.Text)

Thanks,
Matt


Dim oDataSet as System.Data.DataSet = MyQueryMethod(txtPhone.Text)

If oDataSet = Nothing Then
' your dataset is jacked up
Else
' You got a dataset to work with
End If

' Release memory allocations to the variable.
oDataSet.Dispose()

|||Simply amazing! It's so easy once someone tells you how it is. Worked like a charm...Now I'm all jacked up!!!

Much Respect!!!!

Thanks,
Matt|||Well actually, it didn't quite do as I expected but I'm close. When I execute this code, I am expecting the dataset to have no records or one record, but either way the DataSet is never nothing (at least from my testing).

Maybe I'm just going about my problem the wrong way. I am trying to validate phone number so that I don't have someone enter a duplicate key in my database. So I run an SQL select statement that returns a dataset. The dataset should have one phone number or no phone number and this is how I'm trying to ward off any duplicate keys.

Is there an easier way to prevent a duplicate key entry? Sorry, I'm new at this stuff!!|||You can code as


If oDataSet.Tables(0).Rows.Count = 0 Then
' your have no records
Else
'Response.Write(oDataSet.Tables(0).Rows(0)(0).ToString())
End If

HTH|||Perfect...thanks.

Monday, March 19, 2012

datareader problem

Hi,

I cant seem to get this working right...I have a datareader which i loop through...i want to test each value to see if its null but i cant get the syntax right.

I know i use dr.item("columnname") or dr(0) to pick a certain column but i dont know the column names and want to check them all anyway. What is the syntax to do this.

Thanks for any help...this is prob very simple but just cant see it.

--------------

While dr.Read

If dr(0)Is System.DBNull.ValueThen

Return"test"

EndIf

EndWhile

I useually would add the following to identify the columns by:

msgbox(dr(0))

msgbox(dr(2)) and so on.

or use response.write(dr(0))

|||

Hi

Ireland:

...i want to test each value to see if its null but i cant get the syntax right.

Ireland,

if i remember right, no VS in front of me, its similar to

while(reader.Read()){// not sure if fields the correct property namefor(int i=0; i < reader.fields.count; i++) {// iterate throu all fields in the rowif(reader[i] ==typeof(string)) {string str = reader[i]; } }}

the correct property you see in the reader intellisence. But i think it was fields

|||

you can try dr.FieldCount. That will give you the number of columns in the datareader.

The code will be something like this (sorry my VB.NET is no good)

While dr.Read
for iCtr=0 to dr.FieldCount
if dr(iCtr) Is System.DBNull.Value Then

Return "test"

End If
Next
End While

Sunday, March 11, 2012

Datagram message

My app was working fine (no change in the last couple of years) until
recently.
Here is an example of my XML -
<root
xmlns:updg="urn:schemas-microsoft-com:xml-updategram"><updg:sync><updg:before><ProbePart
VFPID="28724"/></updg:before><updg:after><ProbePart
ReconSell="5520"/></updg:after></updg:sync></root>
which results in the Response -
<H3>ERROR: 400.100 Bad Request</H3><b>HResult:</b>
0x80004005<br><b>Source:</b> Microsoft SQL isapi
extension<br><b>Description:</b> Query not specified<br>
Not sure where to look for resolution - any pointers would be appreciated.
Could you please provide some more information? Like what your setup is and
a simple complete repro?
Thanks
Michael
"howard" <howard@.discussions.microsoft.com> wrote in message
news:1B14174A-7CC0-4B78-BB8E-15EC906834BE@.microsoft.com...
> My app was working fine (no change in the last couple of years) until
> recently.
> Here is an example of my XML -
> <root
> xmlns:updg="urn:schemas-microsoft-com:xml-updategram"><updg:sync><updg:before><ProbePart
> VFPID="28724"/></updg:before><updg:after><ProbePart
> ReconSell="5520"/></updg:after></updg:sync></root>
> which results in the Response -
> <H3>ERROR: 400.100 Bad Request</H3><b>HResult:</b>
> 0x80004005<br><b>Source:</b> Microsoft SQL isapi
> extension<br><b>Description:</b> Query not specified<br>
> Not sure where to look for resolution - any pointers would be appreciated.
>
>

Thursday, March 8, 2012

Datafiles placement in filegroup

I'm working with a production database connecting remotely. All the datafile
s, index files and log is placed on the same disk but in different filegroup
names based on separate physical files. But I expect if I place the index f
iles or/add log files sep
arate from the datafiles I mean in different disk it will improve the perfor
mance.
If my expectation is correct then can I change the place of the index and lo
g files in separate location while the database is on-line yes the database
is implemented with log-shipping too.
Please evaluate my query and do give a proper suggestion.
Thanks in advance
Sunilsurely it will improve the performance if the log files are placed seperate
from the data files (different disks).
for the indexes u can delete the existing index and recreate it specifying
the new location.
"Sunil" <anonymous@.discussions.microsoft.com> wrote in message
news:4690C174-4988-4737-82D9-7C0ED08FDF5D@.microsoft.com...
quote:

> I'm working with a production database connecting remotely. All the

datafiles, index files and log is placed on the same disk but in different
filegroup names based on separate physical files. But I expect if I place
the index files or/add log files separate from the datafiles I mean in
different disk it will improve the performance.
quote:

> If my expectation is correct then can I change the place of the index and

log files in separate location while the database is on-line yes the
database is implemented with log-shipping too.
quote:

>
> Please evaluate my query and do give a proper suggestion.
>
> Thanks in advance
> Sunil
>

Datafiles placement in filegroup

I'm working with a production database connecting remotely. All the datafiles, index files and log is placed on the same disk but in different filegroup names based on separate physical files. But I expect if I place the index files or/add log files separate from the datafiles I mean in different disk it will improve the performance.
If my expectation is correct then can I change the place of the index and log files in separate location while the database is on-line yes the database is implemented with log-shipping too.
Please evaluate my query and do give a proper suggestion.
Thanks in advance
Sunilsurely it will improve the performance if the log files are placed seperate
from the data files (different disks).
for the indexes u can delete the existing index and recreate it specifying
the new location.
"Sunil" <anonymous@.discussions.microsoft.com> wrote in message
news:4690C174-4988-4737-82D9-7C0ED08FDF5D@.microsoft.com...
> I'm working with a production database connecting remotely. All the
datafiles, index files and log is placed on the same disk but in different
filegroup names based on separate physical files. But I expect if I place
the index files or/add log files separate from the datafiles I mean in
different disk it will improve the performance.
> If my expectation is correct then can I change the place of the index and
log files in separate location while the database is on-line yes the
database is implemented with log-shipping too.
>
> Please evaluate my query and do give a proper suggestion.
>
> Thanks in advance
> Sunil
>|||You are mostly correct.
Creating new files doesn't automatically improve
performace, it also depends upon the raid configuration of
the disk its going on.
For instance putting a log file on a RAID 0 disk will make
it faster than putting it on a raid 5 disk.
Although its different for every type of application a
normal implementation with cost constraints its to put the
log files on a raid 0 or raid 0+1 with the data files on
raid 5.
J
>--Original Message--
>I'm working with a production database connecting
remotely. All the datafiles, index files and log is placed
on the same disk but in different filegroup names based on
separate physical files. But I expect if I place the index
files or/add log files separate from the datafiles I
mean in different disk it will improve the performance.
>If my expectation is correct then can I change the place
of the index and log files in separate location while the
database is on-line yes the database is implemented with
log-shipping too.
>
>Please evaluate my query and do give a proper suggestion.
>
>Thanks in advance
>Sunil
>.
>

Wednesday, March 7, 2012

Data-driven subscription not working

I created a data-driven subscription for my report with "Null Delivery Provider" set in report manager. I set the processing to "On a schedule created for this subscription" and scheduled the report to "run once" in the next 1 minute so I could test it. The subscription added successfully, but I don't see the "last run information" even after 5 minutes. Am I missing something?

Thanks in advance!!!

Check SQL Server for any failures reported in the log.

Data-Driven Subscription not shown

I am upgradinding to sql 2005 and the Data-Driven subscription is not working. the data-Driven option It is now showing in report manager and in code I get the error " rsOperationisNotSupported".... I have the same security permitions I had before in sql 2000. Does anyone knows if there is another difference that would prevent the subscription from working ?

thank you

drey

What sku of SQL 2005 are you using? Data driven subscriptions are only supported on developer and enterprise editions.|||

thank you,

I am using Standard edition, my company does not have enterprise. I guess that is a deal breaker for upgrading...

|||

Data driven subscriptions was also an Enterprise / Developer Edition in RS 2000. It was not available for the Standard Edition.

-- Robert

Data-Driven Subscription Error

I working through the 'Creating a Data-Driven Subscription' walkthrough
supplied as part of the BOL documentation, using Report Server File
Share as the delivery method. It cannot generate the report using the
three sets of dummy user details. The resulting status is: 'Done: 3
processed of 3 total: 3 errors'. How can I resolve this error?Sounds like possibly there was an error in writing out the files to the
file share (...since 3 of 3 procesed).
Open the ReportSever_ error log (C:\Program Files\Microsoft SQL
Server\MSSQL\Reporting Services\LogFiles), and do a Find on 'Success:
False' to locate errors in the log, using the timestamps to narrow
down the entries you look at. Errors could include illegal file names
or permissions on file share etc.
Matt A

DataDir Property - Is it possible to store files on more than 1 drive?

The "DataDir" property for an AS 2005 instance seems to only allow for one path to be specified. I am working with a very large data set that is being updated frequently and I would like to be able to reference more than on LUN on my disk array.

Yes, you can.

Take a look at the StorageLocation property of your partition.

Edward Melomed (MSFT)

--

This posting is provided "AS IS" with no warranties, and confers no rights.

Datadesign - help request

HI There,

Im now working on a assignment where i have hierarchial tree structure arrangement for representing an health care. This is supported by SQL DB 2005.One of the node in the tree is dissolved and all it functionality have to ported to the other tree node which share the similar structure.
Problem in porting is complex due to the following things

1. There are capabilities and permission associated with the each node.

2.each node has a unique identifier across the three (note: though this seems to be of no problem it might become issue when search occurs for eg. a->b->c search now becomes a->b->x->n ->?).

3.Already there are messages left in the DB. Please can anyone help me how can i initiate this migration. Im very new to the design and im just started "ABCD" of it.

Thanks in advance.

Cheers,
Vidhya Raocould you please script the table, i.e. show us the CREATE TABLE statement|||Hi There,

Please can you tell me in detail what u require.

Cheers,
Vidhya|||why don't you start with the CREATE TABLE statement

:)|||Hello,

it is not a data design, it is refactoring a database design which has a hierarchial relationship.

Cheers,
Vidhya|||okay, then

you can start by explaining what you mean by "refactoring"

and i will ask you for the 3rd time, would you please show us your CREATE TABLE statement so that we can see what kind of a hierarchy you have|||Hello,

IF you are available online please do let me know i can send you the DB diagrams. There are many tables and they exhibit strong relationship.
DB structure is not hierarchial but way the directory which im trying to port is the hierarchical.

Please provide me your mail id if possible!!1

Cheers,
Vidhya|||sorry, i don't provide private support for free!!!111|||hi yeh,

Im actually looking for a good mentor to help out i this project.

Im very new to design and started learning now. If you are really an experieced designer please let me know.

if you need contact let me know. Im planning to pay for the service.

Cheers,
Vidhya|||Did someone fib on their resume, and now they have to pay the piper ?

Not a fun situation to be in.:S|||you mentioned medical data and hierarchial tree structure...

are you converting a mumps hierarchial database to a SQL database ?|||are you converting a mumps hierarchial database to a SQL database ?

* Ouch *

Databse replication

Dear All

I've made transactional replication between two SQL 2005 servers.
Everything looks fine, synchronization working fine, no errors, however size of replicated database file = 97 Mb,
on Publications server the database file size = 184 Mb.

What is wrong :S ?

Best Regards
PiotrMB?

You should be using Access|||Sounds like the equivalent of shrinking to me...|||Sounds like the equivalent of shrinking to me...

It's funny you talk about shrinkage, and your name is George|||The data on the replicated server has been defragmented. behind the scenes, the snapshot bcp's out the data from the publisher, and bcp's it in to the subscriber. This removes any whitespace created by deletes and page splits.|||That's a much more elegant way of putting it...
I had the whole "Ya know when you defrag your PC..." conversation knocking about in my head.

Databse is lost

Hi,
I am using windows server STD 2003, with SP1, with SQL server 2000 with SP1.
The database stops working almost every 24 hours. I have to stop/kill
services and then start again to get it back up.
Kindly advise.
ThanksYou would want to start by checking the SQL Server error
logs and the Windows event logs. There should be something
logged to give you some clues as to what is going on with
your SQL Server.
-Sue
On Mon, 15 May 2006 22:35:01 -0700, Al Gates
<AlGates@.discussions.microsoft.com> wrote:

>Hi,
>I am using windows server STD 2003, with SP1, with SQL server 2000 with SP1
.
>The database stops working almost every 24 hours. I have to stop/kill
>services and then start again to get it back up.
>Kindly advise.
>Thanks

Sunday, February 26, 2012

Databases Syncronization

Hello Sir/Madam,
I need some help from you.I am working as an RA in a real-time
project,on itegration of Emergency medical services with wireless
technolgies, which involves work on databases.
1)I have a problem now, where I need to write a desktop application
which will syncronise 2 databases.

One database(which will be on a mobile ambulance server) should
constantly check for connection with a main database which is on
another server in someother place and should constantly update as well
as pull information from that. In other words both should be in
syncronisation.
2)First of all I do not know what is a desktop apllication and how
does it differ from other applications.

3)Is there any tutorials which would teach me how to do this, how to
write a desktop application for this? I know there are some tools
which will do this for us, but we want an application to be built by
us, so that we can modify it acording to our requirement.I am jus a
begginer in databses, so I dont know about databases to this extent,
so I need your help.

Thank you, It would be of great help if you could even tell me how go
about this.
Soumyamsowmya@.uab.edu (Sowmya Mulukutla) wrote in message news:<91fbf545.0406111019.43d98df8@.posting.google.com>...
> Hello Sir/Madam,
> I need some help from you.I am working as an RA in a real-time
> project,on itegration of Emergency medical services with wireless
> technolgies, which involves work on databases.
> 1)I have a problem now, where I need to write a desktop application
> which will syncronise 2 databases.
> One database(which will be on a mobile ambulance server) should
> constantly check for connection with a main database which is on
> another server in someother place and should constantly update as well
> as pull information from that. In other words both should be in
> syncronisation.
> 2)First of all I do not know what is a desktop apllication and how
> does it differ from other applications.
> 3)Is there any tutorials which would teach me how to do this, how to
> write a desktop application for this? I know there are some tools
> which will do this for us, but we want an application to be built by
> us, so that we can modify it acording to our requirement.I am jus a
> begginer in databses, so I dont know about databases to this extent,
> so I need your help.
> Thank you, It would be of great help if you could even tell me how go
> about this.
> Soumya

Assuming that this is an academic exercise (I notice you're posting
from a .edu address), then I would suggest asking your teachers for
guidance, if they didn't already give you some sources to consult. I
guess that they want you to investigate the issues related to merging
data when update conflicts can arise - in MSSQL2000, merge replication
is one example of this process. You might want to read up on that in
Books Online to see some of the issues to be considered.

Simon

Sunday, February 19, 2012

DatabaseDefaults Policy (not working?)

I created the following policy. It's a basic policy for enforcing database settings. I then created a database in violation of the policy and didn't generate an error. I also altered the database to violate the policy and still didn't get any policy errors.

alter database test2

set auto_close on

<?xml version="1.0" encoding="utf-8" ?>

- <SfcSerializerFragment SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.PolicyStore">

- <SfcInstance SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.Policy">

<SfcProperty Name="Name">Enterprise_DatabaseCreate</SfcProperty>

<SfcProperty Name="Description" />

<SfcProperty Name="Condition">DatabaseDefaults</SfcProperty>

<SfcProperty Name="PolicyGroup">Enterprise</SfcProperty>

<SfcProperty Name="Enabled">True</SfcProperty>

<SfcProperty Name="AutomatedPolicyExecutionMode">CheckOnChanges</SfcProperty>

- <SfcInstance SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.TargetFilter">

<SfcProperty Name="TargetType">DATABASE</SfcProperty>

<SfcProperty Name="Filter">Server/Database</SfcProperty>

<SfcProperty Name="TargetTypeSkeleton">Server/Database</SfcProperty>

</SfcInstance>

</SfcInstance>

- <SfcInstance SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.Condition">

<SfcProperty Name="Name">DatabaseDefaults</SfcProperty>

<SfcProperty Name="Description" />

<SfcProperty Name="Expression"><Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoClose</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>False</Value> </Constant> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoCreateStatistics</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>True</Value> </Constant> </Operator> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoCreateStatisticsEnabled</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>True</Value> </Constant> </Operator> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoShrink</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>False</Value> </Constant> </Operator> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoUpdateStatistics</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>True</Value> </Constant> </Operator> </Operator></SfcProperty>

<SfcProperty Name="Facet">IDatabaseFacet</SfcProperty>

</SfcInstance>

</SfcSerializerFragment>

I then created a subsequent policy (policy 2) with just the "AUTO CLOSE = FALSE" and this will ONLY throw an error when I "TEST" the policy. It doesn't throw the error when I run the ALTER DATABASE TSQL.

I created a 3rd database in violation of POLICY2 and was successfuly able to create the db without generating an error.

Is policy manager working properly? Shouldn't it work on CREATE DATABASE? Shouldn't it work without selecting "TEST" on policy?

Thanks

Steve

(SteveBouffard@.discussions.microsoft.com) writes: > I created the following policy. It's a basic policy for enforcing > database settings. I then created a database in violation of the policy > and didn't generate an error. I also altered the database to violate > the policy and still didn't get any policy errors. But if you look in Mgmt Studio, doesn't the database have some warning sign attached to it? I was not able to import your XML document, but you have CheckOnChanges. To get an error when you violated a policy you need Enforce. But when I tried to set up a policy to prohibit databases with auto-close, Enforce was greyed out. I guess this is because CREATE and ALTER DATABASES are commands that cannot be rolled back, so it is not possible to enforce them. -- Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx|||

The execution modes for a policy are determined by the facet. The facet defines the events to listen to for Enforce and Check on Change (CoC). In order for the facet to define events for Enforce, the target type (e.g. database, table, view, etc) must be completely transactional. In the case of Database, create database is not completely transactional and therefore enforce is not support on conditions built-on database facets. Yes, the create database transaction can be canceled, but the system is not returned to the previous state. Therefore, DMF doesn't support enforce.

Cheers,

Dan

|||ok, thanks

DatabaseDefaults Policy (not working?)

I created the following policy. It's a basic policy for enforcing database settings. I then created a database in violation of the policy and didn't generate an error. I also altered the database to violate the policy and still didn't get any policy errors.

alter database test2

set auto_close on

<?xml version="1.0" encoding="utf-8" ?>

- <SfcSerializerFragment SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.PolicyStore">

- <SfcInstance SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.Policy">

<SfcProperty Name="Name">Enterprise_DatabaseCreate</SfcProperty>

<SfcProperty Name="Description" />

<SfcProperty Name="Condition">DatabaseDefaults</SfcProperty>

<SfcProperty Name="PolicyGroup">Enterprise</SfcProperty>

<SfcProperty Name="Enabled">True</SfcProperty>

<SfcProperty Name="AutomatedPolicyExecutionMode">CheckOnChanges</SfcProperty>

- <SfcInstance SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.TargetFilter">

<SfcProperty Name="TargetType">DATABASE</SfcProperty>

<SfcProperty Name="Filter">Server/Database</SfcProperty>

<SfcProperty Name="TargetTypeSkeleton">Server/Database</SfcProperty>

</SfcInstance>

</SfcInstance>

- <SfcInstance SfcDomain="Dmf" SfcType="Microsoft.SqlServer.Management.Dmf.Condition">

<SfcProperty Name="Name">DatabaseDefaults</SfcProperty>

<SfcProperty Name="Description" />

<SfcProperty Name="Expression"><Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>AND</OpType> <Count>2</Count> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoClose</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>False</Value> </Constant> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoCreateStatistics</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>True</Value> </Constant> </Operator> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoCreateStatisticsEnabled</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>True</Value> </Constant> </Operator> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoShrink</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>False</Value> </Constant> </Operator> </Operator> <Operator> <OpType>EQ</OpType> <Count>2</Count> <Attribute> <Name>AutoUpdateStatistics</Name> </Attribute> <Constant> <ObjType>System.Boolean</ObjType> <Value>True</Value> </Constant> </Operator> </Operator></SfcProperty>

<SfcProperty Name="Facet">IDatabaseFacet</SfcProperty>

</SfcInstance>

</SfcSerializerFragment>

I then created a subsequent policy (policy 2) with just the "AUTO CLOSE = FALSE" and this will ONLY throw an error when I "TEST" the policy. It doesn't throw the error when I run the ALTER DATABASE TSQL.

I created a 3rd database in violation of POLICY2 and was successfuly able to create the db without generating an error.

Is policy manager working properly? Shouldn't it work on CREATE DATABASE? Shouldn't it work without selecting "TEST" on policy?

Thanks

Steve

(SteveBouffard@.discussions.microsoft.com) writes: > I created the following policy. It's a basic policy for enforcing > database settings. I then created a database in violation of the policy > and didn't generate an error. I also altered the database to violate > the policy and still didn't get any policy errors. But if you look in Mgmt Studio, doesn't the database have some warning sign attached to it? I was not able to import your XML document, but you have CheckOnChanges. To get an error when you violated a policy you need Enforce. But when I tried to set up a policy to prohibit databases with auto-close, Enforce was greyed out. I guess this is because CREATE and ALTER DATABASES are commands that cannot be rolled back, so it is not possible to enforce them. -- Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx|||

The execution modes for a policy are determined by the facet. The facet defines the events to listen to for Enforce and Check on Change (CoC). In order for the facet to define events for Enforce, the target type (e.g. database, table, view, etc) must be completely transactional. In the case of Database, create database is not completely transactional and therefore enforce is not support on conditions built-on database facets. Yes, the create database transaction can be canceled, but the system is not returned to the previous state. Therefore, DMF doesn't support enforce.

Cheers,

Dan

|||ok, thanks