Showing posts with label store. Show all posts
Showing posts with label store. Show all posts

Monday, March 26, 2012

More Bytes returned from Image Data Type

I have a field set to Image data type, and store a long string(possible othe
r
objects)into it with size 5663, and returned with 5663+28 bytes.
These strings wil be deserialized after retrieving. However failde because
the bytes seems to include some extra bytes with \0 and 0x01 and have 28 mor
e
bytes ahead of the original string.
How could I deal with it? Just remove the first 28 bytes? It this method
formal? I had thought the returned bytes should have the same size with the
one I stored into, it seems not, am I right?
Thanks.BOL talks about "BLOBs and OLE Objects" and the normal process for images wa
s
to read in "chunks" (e.g. Sussman's ADO 2.6 Wrox book), but now should use
Stream object instead - check your doc [you omitted to say what
language/version you were using]
HTH
Dick
"zhaounknown" wrote:

> I have a field set to Image data type, and store a long string(possible ot
her
> objects)into it with size 5663, and returned with 5663+28 bytes.
> These strings wil be deserialized after retrieving. However failde because
> the bytes seems to include some extra bytes with \0 and 0x01 and have 28 m
ore
> bytes ahead of the original string.
> How could I deal with it? Just remove the first 28 bytes? It this method
> formal? I had thought the returned bytes should have the same size with th
e
> one I stored into, it seems not, am I right?
> Thanks.|||I am using C#, in .Net framework 1.1.
What documentation I shoudl refer to, since I can't find one addressing
this, partly because I am new to the BLOB data type.
However, how the underlying BLOB field is implemented doesn't matter to the
queried result for a BLOB field, is that right?
Please give more detailed guidance for this.
Thank you very much.
"Dick in UK" wrote:
> BOL talks about "BLOBs and OLE Objects" and the normal process for images
was
> to read in "chunks" (e.g. Sussman's ADO 2.6 Wrox book), but now should use
> Stream object instead - check your doc [you omitted to say what
> language/version you were using]
> HTH
> Dick
> "zhaounknown" wrote:
>

Wednesday, March 7, 2012

Monitor MemToLeave usage

Hi,
I am interested in detecting possible memory leaks in extended store
procedures.
Is there a way to monitor MemToLeave usage ?
setup:
win2k advanced server sp4 (cluster)
sql server 2000 advanced server sp3a
AWE + PEA
Total mem 7Gb
Mem for sql server 6Gb
/JanWe use a combination of VMSTAT.EXE to get the total free and xp_memory_size
(comes with SQL Litespeed) to get the max contiguous block. We use these to
populate 2 of the user settable SQL counters so that we can monitor the
levels and raise alerts if the max contiguous block falls below 5MB which
allows us enough time to schedule a restart of the instance.
--
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Jan Ahlbeck" <NoSpam@.dk.dk> wrote in message
news:OB%23ULJ8VFHA.2960@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I am interested in detecting possible memory leaks in extended store
> procedures.
> Is there a way to monitor MemToLeave usage ?
> setup:
> win2k advanced server sp4 (cluster)
> sql server 2000 advanced server sp3a
> AWE + PEA
> Total mem 7Gb
> Mem for sql server 6Gb
> /Jan
>

Saturday, February 25, 2012

Money, SQL Server and C#

Argggg...

Please help.

I need to store money in SQL Server.
I am using C# and a stored procedure to insert.

How do you accomplish this? Specifically what datatype should the money variable be in C# during the insert? It's initial value is a string as it is entered from a text field.

I have been trying for over an hour now to simply insert money into SQL Server using C# and have it stored as a money type!

Thanks

Try using decimal. hth

|||

I did get it working using decimal.. thanks!

Decimal rate = Convert.ToDecimal(txtRate.Text);

Stored procedure looks like this.

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER PROCEDURE sp_UpdateHorsepowerRate

@.HorsePower int,
@.Rate money,
@.UserId uniqueidentifier,
@.EmployerId int

AS

INSERT INTO EmployerHorsePower (HorsePower, Rate, UserId, EmployerId) VALUES (@.HorsePower, @.Rate, @.UserId, @.EmployerId)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Rob

|||

I would recommend that you not begin your stored procedures with "sp" (refer to:http://www.sql-server-performance.com/rd_optimizing_sp_recompiles.asp).

Also, when setting up the SqlParameter be sure that you consider the precision and scale. For themoney datatype, it would be precision=19, scale = 4.

Monday, February 20, 2012

money data type

is money data type can only store 4 decimal places?
what data type should I use if I want to store more than 4 decimal places?
I use SQL server 2000 edition
Did you look at the "decimal" datatype?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"kei" <kei@.discussions.microsoft.com> wrote in message
news:C359CF38-D84A-4B99-8158-55150E573249@.microsoft.com...
> is money data type can only store 4 decimal places?
> what data type should I use if I want to store more than 4 decimal places?
> I use SQL server 2000 edition
|||what is the different between decimal and money datatype? will decimal
datatype less accurate?
"Tibor Karaszi" wrote:

> Did you look at the "decimal" datatype?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "kei" <kei@.discussions.microsoft.com> wrote in message
> news:C359CF38-D84A-4B99-8158-55150E573249@.microsoft.com...
>
>
|||It depends on what precision and scale you specify. I suggest you start by reading about the decimal
datatype in Books Online and post back here if you after that have further questions.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"kei" <kei@.discussions.microsoft.com> wrote in message
news:620A1CE5-B44A-45E8-81D5-2D881FAC9E0E@.microsoft.com...[vbcol=seagreen]
> what is the different between decimal and money datatype? will decimal
> datatype less accurate?
> "Tibor Karaszi" wrote:

money data type

is money data type can only store 4 decimal places?
what data type should I use if I want to store more than 4 decimal places?
I use SQL server 2000 editionDid you look at the "decimal" datatype?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"kei" <kei@.discussions.microsoft.com> wrote in message
news:C359CF38-D84A-4B99-8158-55150E573249@.microsoft.com...
> is money data type can only store 4 decimal places?
> what data type should I use if I want to store more than 4 decimal places?
> I use SQL server 2000 edition|||what is the different between decimal and money datatype? will decimal
datatype less accurate?
"Tibor Karaszi" wrote:
> Did you look at the "decimal" datatype?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "kei" <kei@.discussions.microsoft.com> wrote in message
> news:C359CF38-D84A-4B99-8158-55150E573249@.microsoft.com...
> > is money data type can only store 4 decimal places?
> > what data type should I use if I want to store more than 4 decimal places?
> >
> > I use SQL server 2000 edition
>
>|||It depends on what precision and scale you specify. I suggest you start by reading about the decimal
datatype in Books Online and post back here if you after that have further questions.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"kei" <kei@.discussions.microsoft.com> wrote in message
news:620A1CE5-B44A-45E8-81D5-2D881FAC9E0E@.microsoft.com...
> what is the different between decimal and money datatype? will decimal
> datatype less accurate?
> "Tibor Karaszi" wrote:
>> Did you look at the "decimal" datatype?
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "kei" <kei@.discussions.microsoft.com> wrote in message
>> news:C359CF38-D84A-4B99-8158-55150E573249@.microsoft.com...
>> > is money data type can only store 4 decimal places?
>> > what data type should I use if I want to store more than 4 decimal places?
>> >
>> > I use SQL server 2000 edition
>>