Questions tagged [data-validation]

Data validation is the process of verifying that data meets the requirements of your business logic. This may involve verifying that a foreign key constraint is respected, or ensuring data is properly escaped.

For more detail refer to the Wikipedia page.

26 questions
19
votes
2 answers

How do I determine why a MongoDB document is failing validation?

How do I determine why a MongoDB document insert is failing validation? All I get back is a writeError that says "Document failed validation", which isn't very helpful. (This happens often, and I'd like to understand how to properly debug these,…
Jonathan Wheeler
  • 293
  • 1
  • 2
  • 6
18
votes
1 answer

How do I store phone numbers in PostgreSQL?

Let's assume I want to store phone numbers in a database. I may accept phone numbers from outside of the United States. How would I go about storing these phone numbers?
NO WAR WITH RUSSIA
  • 54,954
  • 34
  • 200
  • 411
5
votes
1 answer

Best Practice for SQL Server data validation

I have CSV files that I would like to import into SQL Server 2014. Each record in the files has around 20 columns, each of them should be validated for data type compliance as well as some other checks per column (min/max ranges, null/not null…
nojetlag
  • 2,737
  • 8
  • 29
  • 38
3
votes
2 answers

Loop through list of fields, check against lookup table

I have a list of fields: FIELD_DOMAIN_ENG_VW +-------------+------------+-------------+ | TABLE_NAME | FIELD_NAME | DOMAIN_NAME | +-------------+------------+-------------+ | ENG.TABLE_1 | FIELD_1 | DOMAIN_ABC | | ENG.TABLE_1 | FIELD_2 |…
User1974
  • 1,323
  • 16
  • 42
3
votes
1 answer

use cases for db.collection.validate() - checks the structures within a namespace for correctness by scanning the collection’s data and indexes

I found on MongoDB mailing list one use case for db.collection.validate(): The count() command is generally an estimate of the current document count, based upon statistics provided by the storage engine. After an unclean shutdown of a mongod…
Josefine
  • 2,158
  • 3
  • 28
  • 55
3
votes
4 answers

Validate three digits before decimal and after decimal point six digits

I have columns called longitude and latitude with nvarchar data type. The user can enter something like (23.23424432),(432423.343), which should not be allowed. Can anyone help me to validate this in SQL Server? Data that can be entered by user:…
teja
  • 31
  • 1
  • 4
3
votes
1 answer

Table structure for validating data using category and subcategory fields

I am creating a simple budget application, and the primary table will be a transaction table that contains things like the amount of the transaction, date, account, the category and subcategory (the type of transaction it was). A spending category…
2
votes
2 answers

Insert/update data into relational database tables only after administrator approval - how to approach it?

I'm building a relational database that holds 21 tables, which is connected to my website application through PHP. The website has search functionality which allows users to search this database. Also, users can enter new data, through a special…
2
votes
1 answer

How to validate data before loading it to DB

I have a situation where in I have million records in CSV file, what I need to do is to apply some business validation on certain columns of CSV and load data to DB only if particular record is valid. I tried with per record strategy but that could…
Vipin
  • 21
  • 4
2
votes
1 answer

How to check the consistency of tables in mysql

I have few questions regarding consistency in Mysql in two scenarios 1st scenario: How can I verify a restored backup matches the original DB data on all the tables? We have two hosts with the same database A and B (the same data, restored to…
com
  • 596
  • 6
  • 16
1
vote
1 answer

Can I enforce one field being dependent on another?

I would like to know if it's possible to have two fields (in this case bits) in the same table where one is dependent on another. For example Check2 may only be true if Check1 is true. Note: I'm trying to implement a constraint in an attempt to…
1
vote
1 answer

Compare table content from different PostgreSQL 9.3 DBs

The problem How do I efficiently and idiomatically compare the content of two tables, each in a different DB? I have 3 DBs (the classic dev, stg and prod). Each DB has a few tables which should be exactly the same regardless of environment, like…
Adam Matan
  • 10,129
  • 27
  • 75
  • 94
1
vote
1 answer

Validating SQL Server Change Tracking Synchronization

I have some tables that I need to synchronize from one SQL Server database to another. I'm using SQL Server's "Change Tracking" feature. My program uses Change Tracking to synchronize the latest changes and then checks to verify that the changes…
1
vote
1 answer

Always Encrypted Data Validation

Just a question in how could i validate duplicate data's in my database if columns is set to be encrypted(deterministic) in db? I've tried running the following code, but receive the error below. declare '@test1' varchar(max) = 'XXXXXX' select *…
Nathan
  • 29
  • 1
  • 7
1
vote
1 answer

SQL Server - MERGE duplicate SOURCE rows validation is only evaluated on UPDATE and DELETE clauses

I want SQL Server to throw an error at me if my SOURCE table contains duplicates as per the ON clause in every case, including INSERT, but it only does for the UPDATE and DELETE cases. Why doesn't it? For example, it takes two executions of this…
1
2