Prevent database file from copying
I am working in a product based company and will
provide SQL Server express 2014 edition with our software.
I want your expert comment on database security.
As we are installing a database on client PC then they
might be able to clone our system by attaching MDF files to another
(In my view, through database objects name and data, other companies can easily
identify our workflow and can develop software easily)
So I want some type of encryption or file system
solution to prevent user to take database files. And yes as we are using
express edition, we can't use available SQL server options.
Difference between foreign key and primary key:
In this post
I will share key differences between foreign key and primary key.
KEY uniquely identifies each record in a database table; main goal is to
prevent duplicate values for columns and provides unique identifier to each
is a column or field in current table and primary key of another table, the
foreign key points to another table using primary key of that table.
table shows all possible differences between MS-SQL Server table primary key and
We can have only one Primary key in a table
We can have more than one foreign
key in a table.
Primary Key can't accept null values.
Foreign key can accept multiple
By default, Primary key is clustered index.
You can manually create an index
(non-clustered) on foreign key.
Primary key supports Auto
Unique Constraint doesn't support
Auto Increment value.
The PRIMARY KEY uniquely
identifies each record in a database table
Foreign key is a field in the
table that is primary key in another table.
धन्यवाद मित्रानो, आपला प्रत्येक दिवस आनंदी आणि सुखी जावो
SQL views and SQL temp tables:
Temp tables and views are totally
different from each other.
View SQL query each time retrieve data
from underlying base table, a temp table is a completely separate database
object. It gets populated with rows when you insert them into it.
a virtual table based on the result-set of an SQL statement and that is Stored in the database
with some name.
SQL temp table:
There is important concept called
temporary tables. With temporary table you can store and process intermediate
results by using the same selection, update, and join capabilities that you can
use with typical SQL tables.
1. Reuse some SQL query logic or reducing
redundancy in writing queries.
2. Maximize performance for complex
calculations and joins; provide easy results and hide complex logic.
3. Providing easy access to query logic to
team members and non-developers.
4. You want to add/remove fields without
modifying your underlying schema (Table schema).
Temporary table use:
1. Use a temp table if you will not reuse
the structure many times or SQL query logic many times.
2. If there is logic which require
manipulation of data that cannot be done within a single query, then in such
cases, the output of one query / intermediate results can be stored in a
temporary table which then participates in further manipulation via joins etc
to achieve the final result.
Common use of temporary tables summarizes
company profit Daily, Weekly, Monthly, Yearly basic. Here temp tables we can
use in stored procedure to manipulate data from multiple table in single SQL
Another example is Custom paging for
web application grid, in which we can return data in set of groups using single
query and temp tables.
One common scenario in using temporary
tables is to store the results of a SELECT INTO statement