|
It really depends on how much precision you need. Oh and if you deal in Indonesian Baht. Also make sure you are not dealing with the Zimbabwe currency, you will run out of zeros very fast.
I work in a finanacial instution and we use decimal 38,6 for all our calcs. We had 38,10 for a while but were getting stray 1 in the 9th decimal position for some reason. Changing to 6 decimal places fixed a lot of issues for us.
Also you cannot convert from e number direct to decimal, you have to go through float first.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
thanks for your reply
Sasmi
|
|
|
|
|
Just as a side point to this, we've used decimal thoughout our database and personally I think its massive overkill. If you are losing precision with a float, then fair enough but high precision decimals take a whopping 17 bytes of space as opposed to your 4 for a float.
In our case, everything fits fine into a float, so the other 13 bytes are just pure overhead. No wonder the database is the size of Belgium.
Regards,
Rob Philpott.
|
|
|
|
|
So,
If you remove the overhead from Belgium, Belgium will float?
Wout Louwers
|
|
|
|
|
Well, that's not quite what I meant, but probably...
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: No wonder the database is the size of Belgium.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
And here I thought I was the only one that cared about database size.
|
|
|
|
|
when i open tables from sql server management studio i have on
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum) The system cannot find the file specified. (Exception from HRESULT: 0x80070002) (Microsoft.SqlServer.ConnectionInfo)
|
|
|
|
|
Have you recently installed SQL Server 2008 Beta or any variant? Can you access the tables from a query?
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
|
|
|
|
|
I CAN NOT ACCESS THE TABLES FROM QUERY ,CAN NOT ACCESS TABLES ,VIEWS AND STORED PROCEDURES
I CAN NOT CREATE NEW DATABASE ...
|
|
|
|
|
Suppose I have a table tblEmpStop
EmpID Date Reason
--------------------------------------------
1 01/01/2009 Fi
2 03/01/2009 Rs
3 03/01/2009 TS
I want to make a view/query which take from tblEmpStop n replace in Coluem Reason
EmpID Date Reason
--------------------------------------------
1 01/01/2009 Fired
2 03/01/2009 Resigned
3 03/01/2009 Temporary Stop
I use Ms SQL Server 2000 with source code:
SELECT EmpID, [Date], IF Reason = Fi, Fire; elseif Reason = Rt, Retired; elseif Reason = Rs, Resigned AS ReasonStop
FROM dbo.tblEmpStop
but it did not work...
How can i do what i want above ?
Thanks you before hand
Best regard,
Sovann
VB.Net
|
|
|
|
|
Its easiest to use CASE[^]. So your query would be like:
SELECT EmpID,
[Date],
CASE Reason
WHEN 'Fi' THEN 'Fire'
WHEN 'Rt' THEN 'Retired'
...
END AS Reason
FROM dbo.tblEmpStop
|
|
|
|
|
Thanks your for your help.
But when i run it show message like:
The Query Designer does not support the CASE SQL construct.
But it was work...
Thanks you again..
VB.Net
|
|
|
|
|
I get the next error message from MS SQL 2000:
"There is already an object named '#Teste' in the database."
DECLARE @x int
SET @x = 5
IF @x > 1
SELECT IDField1
INTO #Teste
FROM Table1
ELSE
SELECT IDField2
INTO #Teste
FROM Table1
(...)
The snippet code above is just an example. I cannot use another temporary table name because the following code must reference #Teste only.
Do you know a solution ?
Thanks
Marcello Turnbull
|
|
|
|
|
Where is your create and drop statement for the temp table? Last I heard a temp table was supposed to be local to the scope of the procedure and it was an error to not global to the entire db. Also, you can look into the possibility of using the new table variable type in SQL Server.
|
|
|
|
|
You seem to use a local temporary table. When such table is created it exists until you either:
- disconnect from the database
- drop the table using DROP TABLE command
So now you create the table in your SELECT ... INTO statement and if you don't drop it somewhere later, you encounter that error when you run the code block the second time.
|
|
|
|
|
I agree there is no DROP statement but it is not enough to fix the problem.
Thanks
Marcello Turnbull
|
|
|
|
|
Don't quite understand. Your problem is that you try to create a table that already exists. So you must either drop it or modify your code so that you don't create the table if it already exists.
|
|
|
|
|
After you answer I added the DROP TABLE in the beginning of the code but it has not worked. I must not modify the code following the snippet.
Thank you
Marcello Turnbull
|
|
|
|
|
Could you post the whole code? Also do you receive the same error or something else?
|
|
|
|
|
DROP TABLE #Teste
DECLARE @x int
SET @x = 5
IF @x > 1
SELECT IDField1
INTO #Teste
FROM Table1
ELSE
SELECT IDField2
INTO #Teste
FROM Table1
(...)
Buddy, the error message is the same.
Thanks
Marcello Turnbull
|
|
|
|
|
That's odd. For some reason the parser interpets that the table is going to be created twice (of course that's not gonna happen since you have IF ... ELSE structure).
However, could you use the following:
DROP TABLE #Teste;
CREATE TABLE #Teste (
IDField1 int
);
DECLARE @x int;
SET @x = 5;
IF (@x > 1)
BEGIN
INSERT INTO #Teste
SELECT IDField1
FROM Table1;
END;
ELSE
BEGIN
INSERT INTO #Teste
SELECT IDField1
FROM Table1;
END;
|
|
|
|
|
Buddy
I apologize for I could not reply yesterday but it was holiday here
Snapshots[^]
It worked so thank you very much
Marcello Turnbull
|
|
|
|
|
You're welcome
|
|
|
|
|
I'm looking for some views/ideas on the following problem that I currently face:
We have a SQL 2000 Application with all the back end code written in SQL, controlled by a VB GUI.
Due to the nature of the app we have fairly frequent code changes to make.
These changes are implemented by a third party, as I do not have access to the production systems.
At the moment I generate lots of .sql files for the various tables, views, sp's etc that are changing and they are just run through QA one at a time.
My problem is finding a more reliable way of deploying these changes, as lots of files means one could be missed etc or ran twice which might present 'non' error errors.
Do people use batch files and the command line? or are third party tools the norm?
|
|
|
|