Is it possible to restrict temporal tables moving data to history table when an update is made to specific column - sql-server-2016

I have a temporal table and I don't want the data in the live table to be moved to history table when I update column1 but I need the data movement if any other column gets updated.
Is it possible to achieve this ? Any ideas would help me lot.
Thanks

Related

SQL: Migrate to a temporal table where history is correct?

I have a table that includes current and historical data. I want to migrate this from the current table to a temporal table, where the history information is correct. How can I achieve this?

Count Customers in a column

I have a table that has 1K rows. In the table there is a column that has the names of the customers. I need to add a column that counts (index) how many customers I have.
Doing a calculated measure using the distinctcount formula I get 3156 customers. My goal is to accomplish the same result of the calculated field in a calculated column.
Thanks for the help.
Not sure about a calculated column but one way you can accomplish this is to make related dCustomers dimension table from your source. You question didn't happen to mention your source - here is how I'd do it for the most common sources in my estimation:
SQL database connection:
SELECT DISTINCT customerField
FROM yourViewOrTable
Excel/Text File:
Duplicate the worksheet with the Linked Table.
On the worksheet copy delete all columns except the Customers column.
With the a single cell active in the data go to Data>Remove Duplicates.
Under the PowerPivot ribbon tab click Create Linked Table.
Now What?
You should now have two tables from whatever source you are using. You'll find your new table has 3156 records in it. Go to Diagram view and drag a relationship from table1.CustomerField to table2.CustomerField.
With the relationship made you should be able to do anything you need to do, but please fire back if you have any questions on your use case.

Possible to have a new table for every row in another table? (SQL)

The only way I can think of doing it, since what I want to do is have a database of all the companies, and their respective information, then have another database per each company that sorts their orders and jobs, Is there a cleaner way than creating a table for each element in the company list table? If not, how would I go about doing this?
create trigger on yourdb for insert
then inside the trigger
create table and insert int it the specific row
Your question is a bit confusing. It seems that you may want to add the company id as a key on all the relations that exist. This would allow you to keep various company information in the same table structure and select from it by filtering on the company id.

What is faster in access: alter + update or create?

I need to add a new column to at table. I wonder if it is faster to run an alter table query to add the new column and then an update query to insert data in the column. In compare to creating at new table.
I suppose I could just try both to see witch is faster, but maybe someone could explain why?
Point of view speed:
It's more faster create only one column instead of re-creating a table
Point of view data consistence:
A table probabily has a lot of relation with other DB table (it can be a foreign table for others), so if you re-creating a table you must value a script about update other tables reference to your.
I hope, I've answered completely to your question. Have a nice day

If exist update else insert records in SQL Server 2008 table

I have one staging table and want to insert data to Main table, so i want to check while inserting data from staging to Main table, if exists then update the records else insert as new records. Here the issue is both the staging as well as Main table does not have any key column based on which i can compare values.
Is it possible to do without having key columns i.e. primary key on both the tables? if yes, please, suggest me how.
Thanks in advance.
If there is no unique key or set of data within a row to define uniqueness, then no.
The set of data can be a combination of the data in each column, creating a sum of parts which will provide uniqueness; however without exposure to your data you would need to make that decision.
You write the WHERE-clause to include all the fields that make your record unique (ie. the fields that decide whether the record is new or should be updated.)
Take a look at this article (http://blogs.msdn.com/b/miah/archive/2008/02/17/sql-if-exists-update-else-insert.aspx) for hints on how to construct it.
If you are using SQL Server 2008r2, you could also use the MERGE statement - I haven't tried it on tables without keys, so I don't know whether it would work for you.