I am trying to insert euro symbol in a sybase table
insert into ABC(viewId,viewType,business) values(16014,'Legal Entity','NV (€)');
But instead of eurosymbol i get -> symbol on insertion.
I need a euro symbol in my table. How can i do so?
What makes you say you don't have a Euro symbol in your table?
Could it be that the client app with which you display the data is not properly converting the character set?
Related
I have the data coming from a flat file source. "unit_Price" (column name) it has the following data.
Unit_Price
00465797857
precisely, I have to convert this values to 465.797857.
In the SSIS package, I conevrted it to DT_R8 and multiplied with 0.000001 so, I got the value in staging table 465.797857. (Staging table I set the datatype for this column as float)
(Datatype in original table is numeric(11,6)) while moving the data from staging to original table, It is rounding off the value to 465.798000. I tried set the datatype as float and real but it is rounding off the value in any case.
Is there anyway, I can get the value in the Original table as it is in Staging table. ? (i.e 465.797857)
Thanks
What is the data type to the currency value in SQL Server.
e.g: I want to store $11.23.
Can I use money type and addtionally will it store the $ symbol?
DECLARE #Price Decimal(18,2) = 11.23
SELECT FORMAT(#Price,'c','en-US') AS 'CURRENCY IN US Culture'
answering to the question in the title, the datatype for currency is MONEY.
the money datatype will store the information only, without the format: in your example the information is 11.23 so that's what is saved into the database.
the $ sign is part of the format so it will not be stored into the money field.
the usual solution is to have a MONEY field for the amount and a VARCHAR field for the currency symbol/name.
I think the best way to store the currency is to use either NUMERIC or DECIMAL data types as these values participates in calculations. If we use NVARCHAR to allow the storage with symbol like ($), it will cost extra during calculations when use in WHERE clause.
We can choose the precision and scale accordingly.
it should be DECIMAL(,) OR NUMERIC in SQL.
eg DECIMAL(20,2)
I have been looking and doing research, and I am having trouble trying to split a table to two files, where one file only have English letters and special characters (such as ,.& () 0-9 - etc) and a second file that has all the records that have a foreign letter.
I have tried veriations of
SELECT * FROM TABLE WHERE Column_name like '%[a-zA-Z0-9]%'
but that would not get special characters
also
SELECT * FROM TABLE WHERE Column_name like '%[\040-\176]%'
The data looks like this (not actual Data)
Doha, The Black Pearl
Jefferson City & Wells
Wenston 89-100
St. Winchester (T)
Piñata Valley
Not süre how to Üse that U
I have 4000 records and want to quickly look through the table. I want all the records but the last two.
You're looking for REGEXP or RLIKE, not LIKE.
I want to structure the table(s) for the database of a multi-lingual dictionary (English - Marathi). Marathi is a regional language in India.
The format of the dictionary is:
word | english_meaning1 | marathi_meaning1 | english_meaning2 |
marathi_meaning2 ... english_meaningN | marathi_meaningN
Words can have variable number of pairs of english and marathi meanings depending upon whether it belongs to any of the lexical categories (Noun, Adverb, Verb, Adjective etc.)
Currently I have thought of an inefficient approach of creating a table like this:
Table: word
word_id
word
english_meaning1
marathi_meaning1
english_meaning2
marathi_meaning2
english_meaning3
marathi_meaning3
english_meaning4
marathi_meaning4
.
.
.
.
english_meaning10
marathi_meaning10
Here I am assuming a fixed number of columns (20) for english and marathi meanings for a word in English. So if a word has only a single meaning (in English & Marathi), the rest of the columns will remain empty.
Also, if it's a word for example: 'about', which in the dictionary is shown as:
about1 - meanings about2 - meanings
Then I'm maintaining them as separate rows in the above structured table.
Isn't this approach problematic? Can this be solved by normalizing it? I have thought of a way
where the tables will be:
Table: word
word_id
word
Table: word_english
id
word_id (FK from word table)
english_meaning
Table: word_marathi
id
word_id
marathi_meaning
I am not pretty sure whether the above approach makes sense. Could anyone suggest a possible solution?? Thanks in advance!
ooof. definitely normalize
word
---------
word_id
word
definition
language_id
lexical_part_id
language
-----------
language_id
name
word_word
------------
word1_id
word2_id
lexical_part
-------------
lexical_part_id
name
then fill in the word_word table with the equivalence map
I have to add a coupon table to my db. There are 3 types of coupons : percentage, amount or 2 for 1.
So far I've come up with a coupon table that contains these 3 fields. If there's a percentage value not set to null then it's this kind of coupon.
I feel it's not the proper way to do it. Should I create a CouponType table and how would you see it? Where would you store these values?
Any help or cue appreciated!
Thanks,
Teebot
You're correct, I think a CouponType table would be fit for your problem.
Two tables: Coupons and CouponTypes. Store the CouponTypeId inside the Coupons table.
So for an example, you'll have a Coupon record called "50% off", if would reference the percent off CouponType record and from there you could determine the logic to take 50% off the cost of the item.
So now you can create unlimited coupons, if it's a dollar amount coupon type it will take the "amount" column and treat it as a dollar amount. If it's a percent off it will treat it as a percentage and if it's an "x for 1" deal, it will treat the value as x.
- Table Coupons
- ID
- name
- coupon_type_id # (or whatever fits your style guidelines)
- amount # Example: 10.00 (treated as $10 off for amount type, treated as
# 10% for percent type or 10 for 1 with the final type)
- expiration_date
- Table CouponTypes
- ID
- type # (amount, percent, <whatever you decided to call the 2 for 1> :))
In the future you might have much more different coupon types. You could also have different business logic associated with them - you never know. It's always useful to do the things right in this case, so yes, definitely, create a coupon type field and an associated dictionary table to go with it.
I would definitely create a CouponType lookup table. That way you avoid all the NULL's and allow for more coupon types in the future.
Coupon
coupon_id INT
name VARCHAR
coupon_type_id INT <- Foreign Key
CouponType
coupon_type_id INT
type_description VARCHAR
...
Or I suppose you could have a coupon type column in your coupon table CHAR(1)