Showing posts with label helloi. Show all posts
Showing posts with label helloi. Show all posts

Friday, March 30, 2012

How to verify constraints after a bulk ? (sql server destination)

Hello

I have four tables as xml. I'm successfully bulk loading them into 4 tables, using the SQL Server Destination, with check constraints unchecked.

The process manages to load all the data without any FK issue.

After that, how can I check the constraints ? (I've read a bit about is_not_trusted and sys.check_constraints)

ThibautHere are my conclusions so far (after googling more, checking this) etc..

It seems that I can establish back the foreign keys and check constraints by doing this on the tables:

alter table MyTable with check check constraint all

The double check will reenable the constraint and check existing data.

I came up with this request to find all the check constraints which are not trusted anymore:

select myschema.name as schema_name, mytable.name as table_name, myconstraint.name as constraint_name
from sys.check_constraints as myconstraint
inner join sys.objects as mytable on mytable.object_id = myconstraint.parent_object_id
inner join sys.schemas as myschema on myschema.schema_id = myconstraint.schema_id
where myconstraint.is_not_trusted = 1

Same applies to foreign keys by selecting from sys.foreign_keys...

Is there any caveat with the approach ?

Thibaut|||Cannot find any caveat for the moment.

The check check constraint all properly detects any error in the loaded data, and the constraints and foreign keys seems to go back to is_not_trusted = 0, just like expected.sql

Wednesday, March 21, 2012

How to use sql server 2000 with SSL

Hello
I want to Use sql server 2000 with SSL.
Is this possible.
Ashish
Hi Ashish
"Ashish kanoongo" wrote:

> Hello
> I want to Use sql server 2000 with SSL.
> Is this possible.
> Ashish
>
Have you checked out http://support.microsoft.com/kb/316898
or http://support.microsoft.com/kb/276553/
John
sql

Monday, March 19, 2012

how to use parameters in method (filter by parameter)

Hello!

I've begin to do a tutorial of this site: Working with Data in ASP.NET 2.0 c#, but in the 3. step I can't make something:

In this step I can't add parameterized methods to the TableAdapter. The problem come up when I want to add Sql query.

SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued
FROM Products
WHERE CategoryID = @.CategoryID

The error message:

Error in WHERE clause near'@.'.
Unable to parse query text.

So, how can i use parameter in this method?

tnx for the help

Simpson

Are you sure you are passing in the parameter values to the TableAdapter when calling in your code?

Thanks

|||Hi

I have the same problem have you found a solution.

Regards
Demetrios|||Hi

I have the same problem have you found a solution.

Regards
Demetrios|||Hi

I have the same problem have you found a solution.

Regards
Demetrios|||

Hi MaoBranca,

This might because the @.CategoryID was not declared properly.

If this is a SQL Server database, please make sure that you have added the parameter to the SqlCommand parameter collection. If it has been added, please also confirm that the data type, size and value are correct.

HTH. If this does not answer you question, please feel free to mark it as Not Answered and post your reply. Thanks!

|||i have found the solution

SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued
FROM Products
WHERE CategoryID = @.CategoryID

this works for sqlserver if you are using an access database then it is

SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued
FROM Products
WHERE CategoryID = ?

if you are using mysql then it is

SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued
FROM Products
WHERE CategoryID = #CategoryID

but i an not sure with mysql