Re: [DotNetDevelopment] SQL Procedure problem

2009-12-07 Thread Kadir Avci
I added this line and works perfect. row_number() OVER ( ORDER BY NEWID() ) randid Thanks for helps. Kadir Avcı Software Developer | Freelance Web Designer web: www.kad1r.com twt: www.twitter.com/kad1r Sent from Izmir, 35, Turkey On Mon, Dec 7, 2009 at 12:47 PM, Raghupathi Kamuni wrote: > Alter

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-07 Thread Raghupathi Kamuni
Alternatives to "Order By NewId() - Slow Performance" http://www.novicksoftware.com/UDFofWeek/Vol1/T-SQL-UDF-Volume-1-Number-21-udf_Num_RandInt.htm http://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql http://msdn.microsoft.com/en-us/library/ms189108.aspx http://sqlblog.com/b

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-06 Thread Kadir Avci
I want to get items randomly. For example If I got 1000 items and my query (select top 20) these 20 items get randomly in 1000 items. If I put Order By Newid() query take long time like 10 sec. Kadir Avcı Software Developer | Freelance Web Designer web: www.kad1r.com twt: www.twitter.com/kad1r Sen

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-05 Thread Raghupathi Kamuni
>Is it possible to get random fields except order by newid()? Please eloborate on the above statement, please clearly state what you are trying to achieve... On 12/5/09, Kadir Avci wrote: > > Hmm I got it. Thanks for links. They really helpful for me. > Is it possible to get random fields excep

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-05 Thread Kadir Avci
Hmm I got it. Thanks for links. They really helpful for me. Is it possible to get random fields except order by newid()? Kadir Avcı Software Developer | Freelance Web Designer web: www.kad1r.com twt: www.twitter.com/kad1r Sent from Izmir, 35, Turkey On Sat, Dec 5, 2009 at 9:46 AM, Raghupathi Kamu

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-04 Thread Raghupathi Kamuni
Even if you select all columns from items table, better select using column names Select using column names from Other tables where you select one or two fields. http://www.mssqlcity.com/Tips/tipTSQL.htm http://www.sql-server-performance.com/tips/tsql_main.aspx http://www.mssqltips.com/category.as

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-04 Thread Kadir Avci
@Raghupathi, I need all fields for just Items table. Other tables I select one or two fields. @Jamie Your first message it works perfect. Can I ask a question? I select items random. I mean I put a condition 'order by newid()' newid = my id and it is uniqueidentifier. If I put this condition query

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Raghupathi Kamuni
select the columns you require, do not select all columns using * On Thu, Dec 3, 2009 at 9:08 PM, Kadir Avci wrote: > Nice idea Process Devil. Thanks. > Jamie, webpage openning time is 3.8 sec. > Query is not taking 1 sec. (It's for 5000 column.) > > Kadir Avcı > Software Developer | Freelance

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Kadir Avci
Nice idea Process Devil. Thanks. Jamie, webpage openning time is 3.8 sec. Query is not taking 1 sec. (It's for 5000 column.) Kadir Avcı Software Developer | Freelance Web Designer web: www.kad1r.com twt: www.twitter.com/kad1r Sent from Izmir, 35, Turkey On Thu, Dec 3, 2009 at 5:31 PM, Processor D

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Processor Devil
Mayber it would be good to try DoS using simple page refreshing If it will get frozen, then something is wrong... 2009/12/3 Jamie Fraser > 3.8 seconds is a long time for a fairly simple query like this. > > Have you use appropriate indexes? > > > On Thu, Dec 3, 2009 at 12:05 PM, Kadir Avci

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Jamie Fraser
3.8 seconds is a long time for a fairly simple query like this. Have you use appropriate indexes? On Thu, Dec 3, 2009 at 12:05 PM, Kadir Avci wrote: > Hmm now it's ok. It has take only 3.8 sec. > I make inner join and then I use again second select. > Thanks for help. > > > Kadir Avcı > Softwar

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Kadir Avci
Hmm now it's ok. It has take only 3.8 sec. I make inner join and then I use again second select. Thanks for help. Kadir Avcı Software Developer | Freelance Web Designer web: www.kad1r.com twt: www.twitter.com/kad1r Sent from Izmir, 35, Turkey On Thu, Dec 3, 2009 at 12:44 PM, Jamie Fraser wrote:

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Jamie Fraser
Assuming you are using SQL2005, the performance of my solution should be better than using dynamic SQL, plus you get the benefits of query caching etc. If your SQL is returning more than one picture, you need to add conditions to return 1 picture only - SQL doesn't know that you only want one. You

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Kadir Avci
Hmm. I use dynamic because the user set the @gosUrun. I take it from codebehind and send to sql procedure. Yesterday I wrote inner join and now its ok. But I didn't know your solution. I will try it asap. How is the performance of yours? Kadir Avcı Software Developer | Freelance Web Designer web:

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-03 Thread Kadir Avci
Second procedure is working but if the item has 2 pictures I saw 2 same item. If 5 or more pictures I saw 5 or more item. But I need just 1 item even if the item has 1 or more pictures. So it's not working. Can I explain it? Sorry for my English. Kadir Avcı Software Developer | Freelance Web Desi

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-02 Thread Raghupathi Kamuni
Use Left Outer JOIN for joining tables AVMWeb_Items AVMWeb_Item_Resources INNER JOIN for joining tables AVMWeb_Items AVMWeb_ItemBrands AVMWeb_ItemSubCategorys exec sp_executeSQL On Tue, Dec 1, 2009 at 4:31 PM, Kadir Avci wrote: > Hello. I have an sql procedure and when I run it the time is 10

Re: [DotNetDevelopment] SQL Procedure problem

2009-12-02 Thread Jamie Fraser
Why are you using SQL like that? You should avoid the use of dynamic SQL like this as it performs comparatively poorly. If you are using SQL 2005 you can parameterise the TOP query (SELECT TOP @topcount) If you are using SQL 2000 or before (why?) you can use the SET ROWCOUNT @topcount pattern

[DotNetDevelopment] SQL Procedure problem

2009-12-02 Thread Kadir Avci
Hello. I have an sql procedure and when I run it the time is 10 seconds. I optimize it and now its take 1 second. But I have a problem. If item has two or more pictures second procedure is not working properly. How can I get only one item_resource in second procedure? *Here is my first sql procedu