U can enter only enter those values in table2(Rank) which are present in Primary Key.
This is the fundamental of having a foreign key. If you want to add values other than those in primary key remove the constraint.
I have multiple results for 1 user. In the example I want the results to get to one row, with the final result (True, True, True, True, True).
So the query has to go through all the results and check if the Access Right is True or False. Is one of them is True the result of the column is true.
I tried to use Temp Tables but im stuck Anyone has an idea?
which would be much easier to query (you can join on ID; you can select on right=true, etc), as well as easier to extend when new access numbers become necessary.
Luc Pattyn [Forum Guidelines][My Articles] The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
You can have your column type as XML and SqlDbType[^] enum supports XML type. You can write something like,
using (SqlConnection conn = /* ... */)
using (SqlCommand cmd = new SqlCommand("insert into your_table VALUES(@xml_content)", conn))
cmd.Parameters.Add("@xml_content", SqlDbType.Xml).Value = new SqlXml(reader);
// other code
SqlXml can take a Stream or a XmlReader instance.
For reading data, work with the SqlDataReader.GetSqlXml()[^] method. SqlXml.ReadOuterXml() will give you a string representation of the XML.