Showing posts with label brand. Show all posts
Showing posts with label brand. Show all posts

Monday, March 26, 2012

Having a problem inserting products

I am trying to write a bit of code that I can pass a brand name to. If the brand name exists I want to return the brandid to the calling middle tier. If the brand id does not exist I want to insert and then return the new brand id. The code below works unless the brand does not exist. Then it inserts, and I get an application exception. Next time I run the code it continues on until the next time it has to do an insert. So the inserts are working, but getting the value back is resulting in an application excetio.

Middle Tier Function (

privatestaticint GetBrandForProduct(clsProduct o)

{

int brandid = -1;// If the brand name comes in blank use the first word of the overstock product

o.BrandName = o.BrandName.Trim();

// if we do not have a brand for this productif (o.BrandName.Length == 0)return -1;Database db =CommonManager.GetDatabase();;try

{

// Get the brand id for this brand name// If it does not exist we will add it and STILL return a brand idobject obj = db.ExecuteScalar("BrandIDGetOrInsert", o.BrandName);string catid = obj.ToString(); *** FAILING LINE ***returnConvert.ToInt32(obj.ToString());

}

catch (Exception ex)

{

throw ex;return -1;

}

return brandid;

}

Stored Procedure: --------------------------------------------------

ALTER

PROCEDURE [dbo].[BrandIDGetOrInsert]-- Add the parameters for the stored procedure here

@.brandnameparm

varchar(50)

AS

BEGIN

-- SET NOCOUNT ONSELECT brandidfrom brandswhereLower(brandname)=Lower(@.brandnameparm)-- If we found a record, exit

if@.@.rowcount> 0return-- We did not find a record, so add a new one.

begin

insertinto brands(Brandname)values(@.brandnameparm)

end

SELECT brandidfrom brandswhereLower(brandname)=Lower(@.brandnameparm)

END

Hi Dear,

You have not mention that What is the Exception Message? I will be in better position to answer if you share Exception Message also...

but the One thing that seems wrong in your SP is

if@.@.rowcount> 0return

-- We did not find a record, so add a new one.

begin

insertinto brands(Brandname)values(@.brandnameparm)

end

@.@.rowcount return 0 if select statement didn't find any result......

so i think this check will be like this

if@.@.rowcount = 0return

-- We did not find a record, so add a new one.

begin

insertinto brands(Brandname)values(@.brandnameparm)

end

change this thing in your Store Procedure , if problem doesn't solve ..then post the Exception message...

Thank You

Best Regards,

Muhammad AKhtar Shiekh

|||

Why would I do that? If the rowcount > 0 then I am happy with the first select and I want the SP to exit. It will have returned the brandid that I need. If the rowcount = 0 then I want to do the insert.

The ASP.NET codes an 'object not defined' exception. The brandid is not being returned after the insert - possible two rows are being returned also which I think an executescalar would not be happy with. How do I get only row to return in either case?

|||

patrick24601:

Why would I do that? If the rowcount > 0 then I am happy with the first select and I want the SP to exit. It will have returned the brandid that I need. If the rowcount = 0 then I want to do the insert.

That's what i am saying but there is contradiction in Your SP...it is doing this

if@.@.rowcount> 0return

-- We did not find a record, so add a new one.

begin

insertinto brands(Brandname)values(@.brandnameparm)

end

It is actually inserting when RowCount is greater then 0 ( Not equal to 0)

......

patrick24601:

The ASP.NET codes an 'object not defined' exception. The brandid is not being returned after the insert - possible two rows are being returned also which I think an executescalar would not be happy with. How do I get only row to return in either case?

You can try this code,

ALTER

PROCEDURE [dbo].[BrandIDGetOrInsert]-- Add the parameters for the stored procedure here

@.brandnameparm

varchar(50)ASBEGIN-- SET NOCOUNT ONIFnotexists(SELECT brandidfrom brandswhereLower(brandname)=Lower(@.brandnameparm))begininsertinto brands(Brandname)values(@.brandnameparm)endelseSELECT brandidfrom brandswhereLower(brandname)=Lower(@.brandnameparm)END

Thanks

Best Regards,

Muhammad AKhtar Shiekh

|||

sorry SP is no correct in above post, Remove the else part in the sp

ALTERPROCEDURE [dbo].[BrandIDGetOrInsert]

-- Add the parameters for the stored procedure here

@.brandnameparm

varchar(50)ASBEGIN-- SET NOCOUNT ONIFnotexists(SELECT brandidfrom brandswhereLower(brandname)=Lower(@.brandnameparm))begininsertinto brands(Brandname)values(@.brandnameparm)endSELECT brandidfrom brandswhereLower(brandname)=Lower(@.brandnameparm)END|||

i think the problem lies with this:

if (o.BrandName.Length == 0)return -1;

Database db =CommonManager.GetDatabase();

;

Notice the stray ;Wink also the if statement is missing some braces

if (o.BrandName.Length == 0)
{
return -1;
}

Thats what looks wrong to me

Monday, March 19, 2012

Hardware/RAID Optimum Setup

I need some help with configuring SQL2K on a brand new machine.
The machine has 6 disks. RAIDx is required (I know more or less nothing
about RAID). My database has one table in particular which is hammered
non-stop.
So, I put the table that is used incessantly on one disk, the transaction
log on another and the data file on another. Does this make sense and what
options would that give me for RAID ?
Thanks
FrankHi Frank
Is your database and OLTP or an OLAP system?
The strategy for RAID is highly dependent on you query types.
Yours sincerely
Thomas Kejser
M.Sc, MCDBA
"Frank Ashley" <aa@.aa.com> wrote in message
news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>I need some help with configuring SQL2K on a brand new machine.
> The machine has 6 disks. RAIDx is required (I know more or less nothing
> about RAID). My database has one table in particular which is hammered
> non-stop.
> So, I put the table that is used incessantly on one disk, the transaction
> log on another and the data file on another. Does this make sense and what
> options would that give me for RAID ?
> Thanks
> Frank
>|||Its OLTP
Thanks
Frank
"Thomas Kejser" <thomas@.kejser.org> wrote in message
news:OhLA5I09EHA.3236@.TK2MSFTNGP15.phx.gbl...
> Hi Frank
> Is your database and OLTP or an OLAP system?
> The strategy for RAID is highly dependent on you query types.
>
> --
> Yours sincerely
> Thomas Kejser
> M.Sc, MCDBA
>
> "Frank Ashley" <aa@.aa.com> wrote in message
> news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>|||"Frank Ashley" <aa@.aa.com> wrote in message
news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>I need some help with configuring SQL2K on a brand new machine.
> The machine has 6 disks. RAIDx is required (I know more or less nothing
> about RAID). My database has one table in particular which is hammered
> non-stop.
> So, I put the table that is used incessantly on one disk, the transaction
> log on another and the data file on another. Does this make sense and what
> options would that give me for RAID ?
> Thanks
> Frank
>
A quick search through the NG will give you this answer. Here it is again
however...
RAID Levels and SQL Server:
http://msdn.microsoft.com/library/e..._tun_1_87jm.asp
Comparing Different Implementations of RAID Levels:
http://msdn.microsoft.com/library/e..._tun_1_79pv.asp
Rick Sawtell
MCT, MCSD, MCDBA

Hardware/RAID Optimum Setup

I need some help with configuring SQL2K on a brand new machine.
The machine has 6 disks. RAIDx is required (I know more or less nothing
about RAID). My database has one table in particular which is hammered
non-stop.
So, I put the table that is used incessantly on one disk, the transaction
log on another and the data file on another. Does this make sense and what
options would that give me for RAID ?
Thanks
Frank
Hi Frank
Is your database and OLTP or an OLAP system?
The strategy for RAID is highly dependent on you query types.
Yours sincerely
Thomas Kejser
M.Sc, MCDBA
"Frank Ashley" <aa@.aa.com> wrote in message
news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>I need some help with configuring SQL2K on a brand new machine.
> The machine has 6 disks. RAIDx is required (I know more or less nothing
> about RAID). My database has one table in particular which is hammered
> non-stop.
> So, I put the table that is used incessantly on one disk, the transaction
> log on another and the data file on another. Does this make sense and what
> options would that give me for RAID ?
> Thanks
> Frank
>
|||Its OLTP
Thanks
Frank
"Thomas Kejser" <thomas@.kejser.org> wrote in message
news:OhLA5I09EHA.3236@.TK2MSFTNGP15.phx.gbl...
> Hi Frank
> Is your database and OLTP or an OLAP system?
> The strategy for RAID is highly dependent on you query types.
>
> --
> Yours sincerely
> Thomas Kejser
> M.Sc, MCDBA
>
> "Frank Ashley" <aa@.aa.com> wrote in message
> news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>
|||"Frank Ashley" <aa@.aa.com> wrote in message
news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>I need some help with configuring SQL2K on a brand new machine.
> The machine has 6 disks. RAIDx is required (I know more or less nothing
> about RAID). My database has one table in particular which is hammered
> non-stop.
> So, I put the table that is used incessantly on one disk, the transaction
> log on another and the data file on another. Does this make sense and what
> options would that give me for RAID ?
> Thanks
> Frank
>
A quick search through the NG will give you this answer. Here it is again
however...
RAID Levels and SQL Server:
http://msdn.microsoft.com/library/en...tun_1_87jm.asp
Comparing Different Implementations of RAID Levels:
http://msdn.microsoft.com/library/en...tun_1_79pv.asp
Rick Sawtell
MCT, MCSD, MCDBA

Hardware/RAID Optimum Setup

I need some help with configuring SQL2K on a brand new machine.
The machine has 6 disks. RAIDx is required (I know more or less nothing
about RAID). My database has one table in particular which is hammered
non-stop.
So, I put the table that is used incessantly on one disk, the transaction
log on another and the data file on another. Does this make sense and what
options would that give me for RAID ?
Thanks
FrankNormally I would give a detailed answer to this but home
time here and I give a life to somebody.
Email me on peternolan67REMOVETHIS@.hotmail.com, nd I wil
go through all the options, rather than the best, its more
a case of the best for your circumstances.
Peter
MCDBA
"A politician needs the ability to foretell what is going
to happen tomorrow, next week, next month, and next year.
And to have the ability afterwards to explain why it
didn't happen."
Winston Churchill
>--Original Message--
>I need some help with configuring SQL2K on a brand new
machine.
>The machine has 6 disks. RAIDx is required (I know more
or less nothing
>about RAID). My database has one table in particular
which is hammered
>non-stop.
>So, I put the table that is used incessantly on one disk,
the transaction
>log on another and the data file on another. Does this
make sense and what
>options would that give me for RAID ?
>Thanks
>Frank
>
>.
>|||Hi Frank
Is your database and OLTP or an OLAP system?
The strategy for RAID is highly dependent on you query types.
Yours sincerely
Thomas Kejser
M.Sc, MCDBA
"Frank Ashley" <aa@.aa.com> wrote in message
news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>I need some help with configuring SQL2K on a brand new machine.
> The machine has 6 disks. RAIDx is required (I know more or less nothing
> about RAID). My database has one table in particular which is hammered
> non-stop.
> So, I put the table that is used incessantly on one disk, the transaction
> log on another and the data file on another. Does this make sense and what
> options would that give me for RAID ?
> Thanks
> Frank
>|||Its OLTP
Thanks
Frank
"Thomas Kejser" <thomas@.kejser.org> wrote in message
news:OhLA5I09EHA.3236@.TK2MSFTNGP15.phx.gbl...
> Hi Frank
> Is your database and OLTP or an OLAP system?
> The strategy for RAID is highly dependent on you query types.
>
> --
> Yours sincerely
> Thomas Kejser
> M.Sc, MCDBA
>
> "Frank Ashley" <aa@.aa.com> wrote in message
> news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>>I need some help with configuring SQL2K on a brand new machine.
>> The machine has 6 disks. RAIDx is required (I know more or less nothing
>> about RAID). My database has one table in particular which is hammered
>> non-stop.
>> So, I put the table that is used incessantly on one disk, the transaction
>> log on another and the data file on another. Does this make sense and
>> what options would that give me for RAID ?
>> Thanks
>> Frank
>>
>|||"Frank Ashley" <aa@.aa.com> wrote in message
news:O9woh4y9EHA.3260@.TK2MSFTNGP14.phx.gbl...
>I need some help with configuring SQL2K on a brand new machine.
> The machine has 6 disks. RAIDx is required (I know more or less nothing
> about RAID). My database has one table in particular which is hammered
> non-stop.
> So, I put the table that is used incessantly on one disk, the transaction
> log on another and the data file on another. Does this make sense and what
> options would that give me for RAID ?
> Thanks
> Frank
>
A quick search through the NG will give you this answer. Here it is again
however...
RAID Levels and SQL Server:
http://msdn.microsoft.com/library/en-us/optimsql/odp_tun_1_87jm.asp
Comparing Different Implementations of RAID Levels:
http://msdn.microsoft.com/library/en-us/optimsql/odp_tun_1_79pv.asp
Rick Sawtell
MCT, MCSD, MCDBA

Friday, March 9, 2012

Hardware design suggestion

I'm implementing a brand new project that consists in a soft-realtime application that executes scheduled operations (tcp commands) stored on a SqlServer 2005 express db. DB and app are always on the same workstation. Let's say that the workload is about 40000 events per day, with periods of activity and more idle periods. The DB is filled by external applications that provides insert/update using ad-hoc sprocs and providing only the 'preedceding event'. The major performance problem I see is given by the fact that each time an event is inserted the sproc must rebuild all the scheduled times (I've build an optimization that uses service broker as to update asynchronously the scheduled times). The application does not requires any special calculation and is very lightweight... it only fetches the db and sends tcp commands. The only 'hard work' is to guarantee the exact time for sending the commands.

Now I have to design the required hardware and I expect some tip from you on how to proceed to build a test workload and how to translate it into 'minimum hardware specification'. Consider that safety is not importand since system are redundant in other ways.
My questions are

- Should I put OS, tempdb, database and logs each on a separate disk array ? My idea is to have a two-disk RAID0 for OS and logfiles, and a n-disk RAID0 for tempdb and appdb

- How to extimate the number of disks to have in the RAID ?

- Should I also consider processor ? I have the idea that processor is not very important while I should pay attention to bus and memory bottlenecks: so I've thought to use DDR2 RAM with a FSB of 1066 MHz and a single dual or quad core cpu, so discarding XEON multiprocessor systems that requires FBDIMM, that AFAIK are slower that DDR2.

- any other suggestion ?

The process you are describing sounds like it could be very intensive. You may want to have others take a very close look at your design to make specific feedback on ways you could make this more efficient.

Regardless, it is very difficult with the information provided to give you a hardware recommendation. One thing I can recommend is you avoid the use of RAID 0 for this. With RAID 0, a single disk failure will cause you to lose the array.

Good luck,
Bryan Smith

|||

I would not use RAID 0 for anything for a project like this. If you lose any disks in a RAID 0 array, you are down.

I would put OS and page file on RAID 1, TempDB on a separate RAID 1, AppDB on separate RAID 10 or 1, and Log files on a separate RAID 10 or 1.

The Intel Tulsa MP 3.4 GHz Xeon (with 16MB of L3 cache) performs very well on SQL Server 2005. If you don't need four CPU's, I would look at the newer, Core2 Duo based CPU's, like the Xeon 5160. Make sure you have enough RAM to ensure you don't have memory pressure (which will also reduce I/O pressure). I would suggest 4GB minimum.

|||I see that both of you have suggested to avoid RAID0, and I want to clarify a point: in our system performance is more important than security on a single machine since the system is fully redundant in the sense that we have more machine that runs in parallel, each one with the same scheduling and performs the same task, plus an 'arbiter' that selects the active machine. So If I loose a disk I have another machine that is fully mirrored to the first one... a sort of RAID1 between machines.

Anyway I'm building a test environment and I expect some sort of failsafe RAID on production machines.
|||

If you have that kind of money to spend, go with RAID 10 (1+0). Even with what you have stated above, I would not recommend RAID 0.

B.

Hardware design suggestion

I'm implementing a brand new project that consists in a soft-realtime application that executes scheduled operations (tcp commands) stored on a SqlServer 2005 express db. DB and app are always on the same workstation. Let's say that the workload is about 40000 events per day, with periods of activity and more idle periods. The DB is filled by external applications that provides insert/update using ad-hoc sprocs and providing only the 'preedceding event'. The major performance problem I see is given by the fact that each time an event is inserted the sproc must rebuild all the scheduled times (I've build an optimization that uses service broker as to update asynchronously the scheduled times). The application does not requires any special calculation and is very lightweight... it only fetches the db and sends tcp commands. The only 'hard work' is to guarantee the exact time for sending the commands.

Now I have to design the required hardware and I expect some tip from you on how to proceed to build a test workload and how to translate it into 'minimum hardware specification'. Consider that safety is not importand since system are redundant in other ways.
My questions are

- Should I put OS, tempdb, database and logs each on a separate disk array ? My idea is to have a two-disk RAID0 for OS and logfiles, and a n-disk RAID0 for tempdb and appdb

- How to extimate the number of disks to have in the RAID ?

- Should I also consider processor ? I have the idea that processor is not very important while I should pay attention to bus and memory bottlenecks: so I've thought to use DDR2 RAM with a FSB of 1066 MHz and a single dual or quad core cpu, so discarding XEON multiprocessor systems that requires FBDIMM, that AFAIK are slower that DDR2.

- any other suggestion ?

The process you are describing sounds like it could be very intensive. You may want to have others take a very close look at your design to make specific feedback on ways you could make this more efficient.

Regardless, it is very difficult with the information provided to give you a hardware recommendation. One thing I can recommend is you avoid the use of RAID 0 for this. With RAID 0, a single disk failure will cause you to lose the array.

Good luck,
Bryan Smith

|||

I would not use RAID 0 for anything for a project like this. If you lose any disks in a RAID 0 array, you are down.

I would put OS and page file on RAID 1, TempDB on a separate RAID 1, AppDB on separate RAID 10 or 1, and Log files on a separate RAID 10 or 1.

The Intel Tulsa MP 3.4 GHz Xeon (with 16MB of L3 cache) performs very well on SQL Server 2005. If you don't need four CPU's, I would look at the newer, Core2 Duo based CPU's, like the Xeon 5160. Make sure you have enough RAM to ensure you don't have memory pressure (which will also reduce I/O pressure). I would suggest 4GB minimum.

|||I see that both of you have suggested to avoid RAID0, and I want to clarify a point: in our system performance is more important than security on a single machine since the system is fully redundant in the sense that we have more machine that runs in parallel, each one with the same scheduling and performs the same task, plus an 'arbiter' that selects the active machine. So If I loose a disk I have another machine that is fully mirrored to the first one... a sort of RAID1 between machines.

Anyway I'm building a test environment and I expect some sort of failsafe RAID on production machines.
|||

If you have that kind of money to spend, go with RAID 10 (1+0). Even with what you have stated above, I would not recommend RAID 0.

B.

Wednesday, March 7, 2012

Hard Drive Brand

I am looking for a 3 drive 36 gig 80 pin hot swappable Raid 5 set of hard
drives and was wondering if anyone has any thoughts on drive brands. Seagate
Cheetah, Maxtor, Dell? It will be running in a Dell Poweredge 2600 server.
The server will be running Win2003 server and SQL 2000 server. I am looking
for reliability. Also looking for a reliable vendor. CDW seems to have good
prices on these.Hi Jon,
Why not go for DELL spares, when u want to use them for
DELL Machine?. IBM HD's are reliable. But i wont suggest it
If your Dell Machine is under warranty or AMC.
At a point if some Technical problem arise, VENDOR A may
blame VENDOR B and vice-versa for the problem & u have to
just watch them! . I already experienced such problems In
my early stages.
Also you might have to post your Query in relevant forums
for better suggestions.
HTH
Regards
Thirumal
Sys.Admin
www.sstil.com
>--Original Message--
>I am looking for a 3 drive 36 gig 80 pin hot swappable
Raid 5 set of hard
>drives and was wondering if anyone has any thoughts on
drive brands. Seagate
>Cheetah, Maxtor, Dell? It will be running in a Dell
Poweredge 2600 server.
>The server will be running Win2003 server and SQL 2000
server. I am looking
>for reliability. Also looking for a reliable vendor. CDW
seems to have good
>prices on these.
>
>.
>