Click here to Skip to main content
15,892,674 members
Home / Discussions / Database
   

Database

 
QuestionJoin SELECT statements? Pin
myNameIsRon1-Mar-06 20:41
myNameIsRon1-Mar-06 20:41 
AnswerRe: Join SELECT statements? Pin
Colin Angus Mackay1-Mar-06 21:04
Colin Angus Mackay1-Mar-06 21:04 
GeneralRe: Join SELECT statements? Pin
myNameIsRon3-Mar-06 5:33
myNameIsRon3-Mar-06 5:33 
QuestionCreate index using ADO.NET??? Pin
wasife1-Mar-06 17:16
wasife1-Mar-06 17:16 
AnswerRe: Create index using ADO.NET??? Pin
Colin Angus Mackay1-Mar-06 20:43
Colin Angus Mackay1-Mar-06 20:43 
GeneralRe: Create index using ADO.NET??? Pin
Paul Conrad2-Mar-06 5:35
professionalPaul Conrad2-Mar-06 5:35 
QuestionSQL Profiler results question Pin
theJazzyBrain28-Feb-06 23:19
theJazzyBrain28-Feb-06 23:19 
QuestionArithmetic overflow error converting expression to data type int. Pin
japel28-Feb-06 13:39
japel28-Feb-06 13:39 
Hello All

I have looked into this on the web and found many articals explaining what causes the problem. Some I understand and some I don't but I am no closer to fixing it so some help would be great.

Problem:

I have a table I AM NOT allowed to alter, I can only run select queries against it. The table has a column called docsize (Document Size) in btyes, I run the following query on it.

Select Sum (DocSize) AS myDocSize From Document

Being bytes these are generally "1001374" bytes in size with around 100 000 rows on the table. The resulting number of the SUM is to big I guess so how to I work around this.

P.S. When I get this final figure I bring it in with this Sub

<br />
    Private Sub TotalDocumentSize()<br />
        Dim Command1 As SqlCommand = New SqlCommand("Select Sum (DocSize) AS myDocSize From Document")<br />
<br />
        Command1.CommandType = CommandType.Text<br />
        Command1.Connection = SQLConnection1<br />
<br />
        Dim myDocSizeVarTmp As Integer = CType(Command1.ExecuteScalar(), Integer)<br />
        BytesToMegabytes(myDocSizeVarTmp)<br />
<br />
    End Sub<br />


And then run this Function

<br />
    Public Function BytesToMegabytes(ByVal Bytes As Double) As Double<br />
        'This function gives an estimate to two decimal<br />
        'places.  For a more precise answer, format to<br />
        'more decimal places or just return dblAns<br />
<br />
        Dim dblAns As Double<br />
        dblAns = (Bytes / 1024) / 1024<br />
        BytesToMegabytes = FormatNumber(dblAns, 2, , , TriState.False)<br />
<br />
        Dim MyItem As ListViewItem<br />
        MyItem = New ListViewItem("Total Document Size (MB)")<br />
        MyItem.SubItems.Add(BytesToMegabytes)<br />
        listStat.Items.Add(MyItem)<br />
    End Function<br />



Any help would be great...Smile | :)

When people make you see red, be thankful your not colour blind.
AnswerRe: Arithmetic overflow error converting expression to data type int. Pin
WoutL1-Mar-06 0:37
WoutL1-Mar-06 0:37 
GeneralRe: Arithmetic overflow error converting expression to data type int. Pin
Le centriste1-Mar-06 1:53
Le centriste1-Mar-06 1:53 
AnswerRe: Arithmetic overflow error converting expression to data type int. Pin
japel1-Mar-06 12:39
japel1-Mar-06 12:39 
Questionnewbie SQL question Pin
Mundo Cani28-Feb-06 10:57
Mundo Cani28-Feb-06 10:57 
AnswerRe: newbie SQL question Pin
Al Ortega28-Feb-06 11:14
Al Ortega28-Feb-06 11:14 
AnswerRe: newbie SQL question Pin
Colin Angus Mackay1-Mar-06 1:25
Colin Angus Mackay1-Mar-06 1:25 
GeneralRe: newbie SQL question Pin
Paul Conrad1-Mar-06 16:44
professionalPaul Conrad1-Mar-06 16:44 
QuestionExamples of creating multirecord databound controls for *WinForms* Pin
Rabb Moshe Plotkin28-Feb-06 5:33
Rabb Moshe Plotkin28-Feb-06 5:33 
QuestionFIFO financial analysis proc - any ideas? Pin
Duncan Edwards Jones28-Feb-06 2:27
professionalDuncan Edwards Jones28-Feb-06 2:27 
AnswerRe: FIFO financial analysis proc - any ideas? Pin
Chris Meech28-Feb-06 3:11
Chris Meech28-Feb-06 3:11 
QuestionErrors connecting to database Pin
Deffiant27-Feb-06 22:40
Deffiant27-Feb-06 22:40 
QuestionInserting Images Pin
monrobot1327-Feb-06 22:08
monrobot1327-Feb-06 22:08 
AnswerRe: Inserting Images Pin
minkinin27-Feb-06 23:49
minkinin27-Feb-06 23:49 
Questionhelp with connecting to database server Pin
cpence2527-Feb-06 19:39
cpence2527-Feb-06 19:39 
AnswerRe: help with connecting to database server Pin
Mike Dimmick28-Feb-06 6:28
Mike Dimmick28-Feb-06 6:28 
GeneralRe: help with connecting to database server Pin
cpence2528-Feb-06 13:03
cpence2528-Feb-06 13:03 
QuestionHow to insert records into two tables using single Query Pin
Rajkamal_dfine27-Feb-06 18:53
Rajkamal_dfine27-Feb-06 18:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.