Multilingual Database design in sql - sql

Need a procedure in SQL for translate a datatable in English to Arabic .I am having English table which is having category ID ,Code etc upto 25 columns in the SQL Database.We want to translate this table to arabic when user opts for Arabic .So need a procedure to convert this English table to Arabic.Do i want to use google translator for this case . Then how will it is linked with database .
Please reply with an answer

you can check these two links:
http://msdn.microsoft.com/en-us/library/ms144250.aspx
http://msdn.microsoft.com/en-US/library/cc295829(v=SQL.90).aspx
Here is a piece of code you can use as example:
CREATE TABLE jobs
(
job_id smallint
IDENTITY(1,1)
PRIMARY KEY CLUSTERED,
job_desc varchar(50)
COLLATE Arabic_CI_AI_KS
NOT NULL
DEFAULT 'New Position - title not formalized yet',
)

Related

Feature from workbench maybe?

I'm trying to create a table in workbench, and I don't know why theses names can be set up. It ask me to change it. Maybe it concern features that I would like to disable.
create table net_shows(
title VARCHAR(100)
,rating VARCHAR(100)
,ratingLevel VARCHAR(100)
,ratingDescription INT(10)
,release year INT(4)
,user rating score FLOAT(4)
,user rating size FLOAT(4)
);
release , user appear in blue like a special command.
A column name is an identifier, and those can't include unless it's a delimited identifier (sometimes called quoted identifier.) Also reserved words need to be delimited. (en.wikipedia.org/wiki/SQL_reserved_words.) In MySQL you use back-ticks to delimit an identifier.
https://dev.mysql.com/doc/refman/8.0/en/identifiers.html

SQL Server 2014 : help creating tables

I am new to MSSQL 2014 Server, my professor listed these steps to make a table, I don't know the proper steps to create tables in the pictures listed below, please help.
Create and populate (insert values) the following tables per table description and data values provided
DEPARTMENT
EMPLOYEE
PROJECT
ASSIGNMENT
Add a SQL Comment to include /* * Your First Name_Your Last Name* */ when inserting corresponding values for each table.
What I tried so far:
CREATE TABLE DEPARTMENT(
DepartmentName Text(35) PRIMARY KEY,
BudgetCode Text(30) NOT NULL,
OfficeNumber Text(15) NOT NULL,
Phone Text(12) NOT NULL, );
I have put this to my query and the error is
Msg 2716, Level 16, State 1, Line 1 Column, parameter, or variable #1: Cannot specify a column width on data type text.
Try this(I assume that your table exists in dbo schema):
IF OBJECT_ID(N'dbo.DEPARTMENT', N'U') IS NOT NULL
BEGIN
DROP TABLE DEPARTMENT
END
GO
CREATE TABLE DEPARTMENT(
DepartmentName varchar(35) PRIMARY KEY,
BudgetCode varchar(30) NOT NULL,
OfficeNumber varchar(15) NOT NULL,
Phone varchar(12) NOT NULL
);
You can not define width for Text data type. In case which you need to define width you can use char or varchar data types. Also keep in mind that if you need to work with Unicode characters then you will need to use nchar or nvarchar instead.

sql: making a table structure for injections

I want to take the values from this site for the country table in my database.
The problem is that they don't provide the table structure, so I have to create one, but I cannot get it right - my phpMyAdmin keeps displaying an error when I want to inject the data into the table I created below:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NUMERIC, alpha3, name, officialName) VALUES ('004','AFG','Afghanistan','Afghan' at line 1
--
-- Table structure for table `countrytable`
--
CREATE TABLE IF NOT EXISTS `countrytable` (
`NUMERIC` int(11) NOT NULL,
`alpha3` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`officialName` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I think my table structure is incorrect. How can I fix it? Thanks!
Try all varchar fields to get the data in since all fields are in quotes in the string you have.
NUMERIC is reserved word in mysql
add in back-tick or quote it -> http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
`alpha3` should be a varchar(3) (or larger), not an int(11).

Selecting from a table and inserting into another table's column of a different type using query in ms access

I have some txt files that contain tables with a mix of different records on them which have diferent types of values and definitons for columns. I was thinking of importing it into a table and running a query to separate the different record types since a identifier to this is listed in the first column. Is there a way to change the value type of a column in a query? since it will be a pain to treat all of them as text. If you have any other suggestions on how to solve this please let me know as well.
Here is an example of tables for 2 record types provided by the website where I got the data from
create table dbo.PUBACC_A2
(
Record_Type char(2) null,
unique_system_identifier numeric(9,0) not null,
ULS_File_Number char(14) null,
EBF_Number varchar(30) null,
spectrum_manager_leasing char(1) null,
defacto_transfer_leasing char(1) null,
new_spectrum_leasing char(1) null,
spectrum_subleasing char(1) null,
xfer_control_lessee char(1) null,
revision_spectrum_lease char(1) null,
assignment_spectrum_lease char(1) null,
pfr_status char(1) null
)
go
create table dbo.PUBACC_AC
(
record_type char(2) null,
unique_system_identifier numeric(9,0) not null,
uls_file_number char(14) null,
ebf_number varchar(30) null,
call_sign char(10) null,
aircraft_count int null,
type_of_carrier char(1) null,
portable_indicator char(1) null,
fleet_indicator char(1) null,
n_number char(10) null
)
Yes, you can do what you want. In ms access you can use any VBA functions and with some
IIF(FirstColumn="value1", CDate(SecondColumn), NULL) as DateValue,
IIF(FirstColumn="value2", CDec(SecondColumn), NULL) as DecimalValue,
IIF(FirstColumn="value3", CStr(SecondColumn), NULL) as StringValue
You can use all/any of the above in your SELECT.
EDIT:
From your comments it seems that you want to split them into different tables - importing as text should not be a problem in that case.
a)
After you import and get it in the initial table, create the proper table manually setting you can INSERT into the proper table.
b)
You could even do a make table query, but it might be faster to create it manually. If you do a make table query you have to be sure that you have casted the data into proper type in your select.
EDIT2:
As you updated the question showing the structure it becomes obvious that my suggestion above will not help directly.
If this is one time process you can follow HLGEM's solution. Here are some more details.
1) Import into a table with two columns - RecordType char(2), Rest memo
2) Now you can split the data (make two queries that select based on RecordType) and re-export the data (to be able to use access' import wizard)
3) Now you have two text files with proper structure which can be easily imported
I did this in my last job. You start with a staging table that has one column or two coulmns if your identifier is always the same length.
Then using the record identifier, you move the data to another set of staging tables, one for each type of record you have. This will be in columns for the data and can have the correct data types. Then you do any data cleaning you need to do. Then you insert into the real production table.
If you have a column defined as text, because it has both alphas and numbers, you'll only be able to query it as if it were text. Once you've separated out the different "types" of data into their own tables, you should be able to change the schema definition. Please comment here if I'm misunderstanding what you're trying to do.

Why cant i use the field user in SQL Server 8?

Maybe not literally but the query below gets an error near user. If i change it to userZ it works. WHY can i not use that name? Is there a way to specific its a field instead of a keyword? (or whatever it is)
create table Post2 (
id INTEGER PRIMARY KEY NOT NULL,
title nvarchar(max)
NOT NULL,
body nvarchar(max)
NOT NULL,
user integer REFERENCES Post1(id));
Reserved words, like user should be enclosed in brackets.
Take a look at Using Identifiers for a more in depth explanation.
CREATE TABLE Post2 (
id INTEGER PRIMARY KEY NOT NULL
, title NVARCHAR(MAX)NOT NULL
, body NVARCHAR(MAX) NOT NULL
, [User] INTEGER REFERENCES Post1(id)
);
USER is a reserved word.
Try delimiting it with "" (e.g. "user" or [user])
Read more on using delimited identifiers here.