How to import a text file into MSSQL

I need to import this file into the following table structure: CREATE TABLE [dbo].[tab_sorts]( [row] [int] IDENTITY(1,1) NOT NULL, [id] [int] NOT NULL, [date_sort] [nchar](10) NOT NULL, [date_day] [int] NOT NULL, [date_month] [int] NOT NULL, [date_ye

how to handle friend requests in sqlserver

I have a requirement in my app where one user can send the friend request to another user. We use SQL Server database as the backend. The structure of the table is like this. CREATE TABLE FriendStatus (FriendStatusId BIGINT PRIMARY KEY IDENTITY(1,1),

Several foreign keys in a table

To design my database, I have a big table that contains Devices specifications (table : "Devices"), there are about 60 columns. The value of several features will be in a predefined list (of 3 or 4 values). They said that we should not have big

To join or not join, database structuring

I'm trying to construct a database that will do the following: "Allow a user to give or take a number of items from another user and leave an optional comment about it." I would think this only would need two tables: Users Table: UserID (PK) Fir

Standardized database design in SQL Server

I am a novice database admin and I am working on a project that would take a hardware inventory spreadsheet and migrate it to SQL server. Currently, the data exists as one large denormalized view. I am trying to achieve 3NF, but somehow I feel that I

Database Design - What would be the best for this?

I'm a newbie messing around at designing a database. I want to create a database(using mysql) that contains employee information. Then I will write Web Client to display each employee profile. I so far the columns would be: 1) user id 2) first name 3

Is it better to use a blank value as '' or as NULL?

Database schema I have this fields: title (string) subtitle description (string) Is better set the default value as an empty string '' or a NULL? For better reading/writing and size-storage performanceThe usual contract is: NULL means "no information

Recommended database structure for user information

I am trying to figure out how I should go about building my database structure (tables) for user information on my website. The kinds of information that I will be storing (at this time anyways) are: About Me Birthday (January, 1, 1970) Sex (Male/Fem

Storing calendar data in MySQL

Just a quick architecture question really on storing calendar data. Basically, I have a database of services for rental. On the front end, there is a calendar to show either "Available" or "Unavailable" for every future date. In the ba

Dynamically create GridView

I want to create a GridView that displays records for PDF Files. These records can have meta data attached that is customizeable by the user, so they can create their own columns and enter their own information in there. I then want it to be displaye

Is it a bad idea to keep a subtotal field in the database

I have a MySQL table that represents a list of orders and a related child table that represents the shipments associated with each order (some orders have more than one shipment, but most have just one). Each shipment has a number of costs, for examp

PHP / MySQL: Processing the entries of the questionnaire

I have a questionnaire for users to be matched by similar interests: 40 categories, each with 3 to 10 subcategories. Each of the subcategories has a 0 - 5 value related to how interested they are in that subcategory (0 being not even remotely interes

Is it bad practice to store multiple IDs in a table column?

I'm working on a project where the database has a few tables that contain a type_id field that stores id's from multiple tables for instance: id | table_type | table id ============================== 1 ADDRESS 1 2 ADDRESS 2 3 CITY 1 4 CITY 2 4 ADDRES

Database Design - Multiple Multiple Relationships

What would be the best way to model 1 table with multiple 1 to many relatiionships. With the above schema if Report contains 1 row, Grant 2 rows and Donation 12. When I join the three together I end up with a Cartesian product and result set of 24. R

NULL or set a default value

I have a table for user questions and each question has a "question_score" field. for this field, if i allow it to be a NULL then this may save some spaces or even maybe save some CPU times, will it? question_id (int) | quesion_name (varchar) |

Django: limitation of model data

I'm searching in a way to limit the queryset which I can get through a model. Suppose I have the following models (with dependencies): Company |- Section | |- Employee | |- Task | `- more models... |- Customer | |- Contract | |- Accounts | `- other g

How is it better to organize a large database of addresses?

How it is better to organise a large database of addresses? It is need to create mysql database of addresses. How it is better for organising? I have two variants: 1) cuontries id|name 1 |Russia cities id|name 1 |Moscow 2 |Saratov villages id|name st

Nullable foreign key bad practice?

Let's say you have a table Orders with a foreign key to a Customer Id. Now, suppose you want to add an Order without a Customer Id, (whether that should be possible is another question) you would have to make the foreign key NULL... Is that bad pract

Do I have to use multiple fields or JSON?

I'm designing a DB and would like to know the best way to store this: I have an user table and let's say it can have 100 item slots, and I store an ID. Should I use JSON ({slot1:123232,slot20:123123123,slot82:23123}) or create 100+ fields (slot1, slo

SQL Server - Synonym Tips & amp; Things?

I've been doing a lot of DB refactoring lately and synonyms have come in incredibly useful. When I originally put in the synonyms I was thinking they would be very temporary while I refactor. Now I am thinking there might be some good reasons to keep