Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Monday, March 26, 2012

Having a hard time connecting to sample SQL database from ASP.Net Page

I am working through the book ASP.Net Unleashed Second Addition. I am trying to open a simple database connection. (using the sample "pubs" db from SQL Server)
I have copied the author's code exactly, but it just won't work. I keep getting this error:
What am I doing wrong???Confused [*-)]

Description:An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message:BC30182: Type expected.
Source Error:
Line 5: Line 6: Sub Page_LoadLine 7: Dim conPubs As SqlConnectionLine 8: conPubs = New SqlConnection( "server=localhost;uid=webuser;pwd=secret;database=pubs" )Line 9: conPubs.Open()
What namespaces have you imported?|||Coding for my namespace is
<%@. Import Namespace="System.Data.SqlClient" %>
This is copied directly from the authors example.... so I don't know if it is right lolWink [;)]
Then under the page_load event
I typed:
<script Runat="server">
Sub Page_Load
Dim conPubs as SqlConnection
conPubs = New SqlConnection( "Server=localhost;uid=sa;pwd=secret;database=pubs" )
conPubs. Open()
End Sub
</script>
The text "Connection Opened!" Is supposed to show up if the coding is correct...
Help hehe just a beginner :)|||Does anyone know some awesome websites that teach you Visual Studio.Net 2003 and database stuff? I have the hardest time finding things in the MSDN library....|||Try:
http://learnvisualstudio.net/|||

I don't know if VB.NEt support the continuation stuff.
If it does, may be u have to put a continuation sign at the end of line 7.
Cheers.

sql

Friday, March 23, 2012

Have to install to c:\ ?

I'm having a hard time with installation of SQL 2005 on Windows Server 2000. I'm trying to put everything on d:\ but I think it is failing as a result. Is there anything I should know about this?

Thanks in advance. -GregAs a follow up on this, as soon as I installed everything to C:\ everything worked stellarly. In listening to the traffic here, it appears 98% of SSRS users are using a non-distributed configuration. While the product supports installing its components on different machines (ie, Database on one box, IIS on anohter box, SQL Srvr on partition A, SSRS Web bits on partition B etc), I am guessing this process will not be well-documented and supported until a subsequent release.

Have to install to c:\ ?

I'm having a hard time with installation of SQL 2005 on Windows Server 2000. I'm trying to put everything on d:\ but I think it is failing as a result. Is there anything I should know about this?

Thanks in advance. -GregAs a follow up on this, as soon as I installed everything to C:\ everything worked stellarly. In listening to the traffic here, it appears 98% of SSRS users are using a non-distributed configuration. While the product supports installing its components on different machines (ie, Database on one box, IIS on anohter box, SQL Srvr on partition A, SSRS Web bits on partition B etc), I am guessing this process will not be well-documented and supported until a subsequent release.

Wednesday, March 21, 2012

Hash join

In some cases when I see the query execution plan I found that Hash
join or Merge join or sort operation is taking about 50% of execution
time.Can I do something to improve it? What is the cause of this high
proportion of execution time taken by this operation?
Regardsamish wrote:
> In some cases when I see the query execution plan I found that Hash
> join or Merge join or sort operation is taking about 50% of execution
> time.Can I do something to improve it? What is the cause of this high
> proportion of execution time taken by this operation?
>
> Regards
Merge joins are generally very quick. They are used when you have sorted
intermediate result sets that must be combined. If they are not
presorted, then a sort operation is visible and this will slow down
thing significantly. Imagine combining two sorted result sets. You start
scanning both of them, top down, looking at key values, and creating a
new result set from the simultaneous scan of both. Easy.
A hash join is more involved and is generally used when a result sets
needs to be joined, but there no keys available to relate them. Hash
values are created from the keys and these values are used for scanning.
A more involved process.
To prevent seeing these types of joins (for most queries) make sure your
joins have index support and the join clauses are SARGable.
Where TABLE1.ID = TABLE2.ID -- Needs indexes that contains the ID column
as the first column on both tables
Where LEFT(TABLE1.ID, 2) = LEFT(TABLE2.ID, 2) -- Not SARGable. Index
will not help
Where ISNULL(TABLE1.ID, 0) = TABLE2.ID -- Not SARGable
Post your tables, ddl, indexes, and query for more help.
David Gugick
Quest Software
www.imceda.com
www.quest.com|||I guess the real question is: are you satisfied with the query's
performance?
I mean, what do you care which part of the query execution is
responsible for which estimated portion of the execution? SQL-Server
will try to execute the query as fast as possible, and hash joins and
merge joins are tools that are used in the process.
Gert-Jan
amish wrote:
> In some cases when I see the query execution plan I found that Hash
> join or Merge join or sort operation is taking about 50% of execution
> time.Can I do something to improve it? What is the cause of this high
> proportion of execution time taken by this operation?
> Regardssql

Monday, March 19, 2012

Harmonic Mean

Hello everyone.
My first time posting here! I have recentl been computing the geometric mean of a column in out Swl Server 200 Db using the following script:
@.PE_Geo = exp(avg(log(PE1)))

this has worked greate, however I need to change this to the harmonic mean. Anyone have any ideas on the cimplest way to do this.

A simple example of the harmonic mean:
If you want the harmonic mean of 10 and 20, you first
take 1/10 and 1/20, find their average, which is 3/40, and then take
the reciprocal of that, 40/3.

In algebra, the harmonic mean h of two numbers a and b is

1 / ( (1/a + 1/b) / 2),

or in other words

1/m = 1/2 (1/a + 1/b).

Thanks for any help!select 1/(sum(1/[value])/count([value]))

You made need to cast your value as a different datatype to prevent rounding errors.

blindman|||Originally posted by blindman
select 1/(sum(1/[value])/count([value]))

You made need to cast your value as a different datatype to prevent rounding errors.

blindman

Thank you!
Float ok?|||Depends on your data. Float and Real are approximate values, and I don't know how they might propogate errors. Numeric and Decimal are more accurate, but you must define their accuracy ahead of time.

blindman|||Thanks again...
BTW: Have an experts-exchange account: 100pts!

http://www.experts-exchange.com/Databases/Q_20704165.html|||I've thought about joining Experts Exchange, but what would I do with the 100 points? Can I trade them in for a toaster?

blindman|||Hehe...

Wednesday, March 7, 2012

hard time understanding the execution plans

SQL server 2005 has a really complicated execution plans that I am really unable to compare two execution plans with each other cumulative.

I can easliy see by eye that one execution plan is slower than the other but is there anyway to compare two execution plans in sql 2005?

Hi,

I'm afraid there is no comparison tool. Here is a reference to the items in the Execution Plan: http://msdn2.microsoft.com/en-us/library/ms175913.aspx. Hope it helps.

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

|||True, either you can export the text based to a file for a comparison or search for any third party tools on web in this regard.|||

my problem is query execution plan does not help me understand the bottlenecks in the system as I can't compare with any realistic thing against.

how do u guys solve this problem? How do u decide that this is a decend query or say this is a bad one?

|||Here are some tips:
Remember that the thickness of arrows hints how many rows are transferred|||

thanks for the tips they are GREAT.

I will look into statistics IO

Hard time master log files

Hi,
I have a small DB, about 200MB, but my transaction log files grows regulary
over 900MB.
The only way I have been able to manage the log file is to detach the
database, delete the log file and reattach the DB.
Is there any better way to manage growing log files?
Thanks in advance
ChristianHi,
Check the recovery model for your database using the below command:-
Select DATABASEPROPERTYEX(<dbname>,Recovery )
If the recovery is Simple then the LDF should grow big intil u have some
batch operation. In that once the trasnaction is over you could
shrink the LDF file using DBCC SHRINKFILE command
If the recovery model is either FULL or BULK_LOGGED then you need to do the
Transaction log backup using BACKUP LOG command. This
will keep the LDF file not to grow.
Thanks
Hari
SQL Server MVP
"Christian Perthen" <abracadabara@.dontreplytothidress.com> wrote in
message news:e2YgKk8QFHA.3928@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a small DB, about 200MB, but my transaction log files grows
> regulary
> over 900MB.
> The only way I have been able to manage the log file is to detach the
> database, delete the log file and reattach the DB.
> Is there any better way to manage growing log files?
> Thanks in advance
> Christian
>

HAPPY NEW YEAR Everyone

Just got cut loose...
have a safe and happy new year!
anyone seen my salt shaker?
damn what a time to misplace it...Happy new year, Brett. Where is the famous query?|||DECLARE @.NewYearsEve datetime
SELECT @.NewYearsEve = 'Dec 31 2003 17:00:00'
SELECT DATEDIFF(mi, GetDate(), @.NewYearsEve)/60.00 As Hours_till_Margaritaville|||May the new year bring happiness to you all.

Happy New Year !!!|||Happy new year everybody ..

Big thanks to all the guys/girls who made this forum valuable.
I want to mention: Brett Kaiser, MCrowley and blindman ..

Thanks a lot guys!|||Originally posted by AccessUser
Happy new year everybody ..

Big thanks to all the guys/girls who made this forum valuable.
I want to mention: Brett Kaiser, MCrowley and blindman ..

Thanks a lot guys!

I second that !!!|||so, what is everyone's New Year's Resolution?



mine's 800x600

hee hee

:cool:

rudy
http://rudy.ca/|||I resolve not to make any resolutions...

Monday, February 27, 2012

Handling world time with SQL and ASP.NET

Hi,

I would like to capture date time in my SQL during a certain operation. This piece of data will be displayed to an ASP.NET page.

When displaying the date time, I want it converted to the local time zone equivalent as set in the user's operating system.

What setup do I need on the SQL and the coding in the ASP.NET page?

Thanks.The following MSDN article may help you to understand date & time and also avoid inherant problems when dealing with different time zones.

Best Practices Using DateTime in the .NET

Hope this helps

Regards

Wayne Phipps|||Hi Wayne,

Thanks. That's a great article on issues related to saving and computing date time when daylight saving is relevant.

I'm also looking for saving date time in one time zone, and then display the date time relevant to the target user's system. I managed to find a web site that's dedicated to addressing this issue, SimpleTimeZone .NET Framework Class (http://www.michaelbrumm.com/simpletimezone.html). However I have not evaluated the .NET class concerned.

Thanks again for your reply.

Friday, February 24, 2012

Handle Time Zones and Daylight Savings Time in SQL Server

I wanted to know how we can handle Time Zones and Daylight Savings Time in SQL Server 2000 as well as 2005.

Any pointers would be helpful.

Pranav

Pranav:

Get started by giving the getUTCDate() funciton a look. Other useful functions include dateadd, datediff, datename, datepart, day, getdate, month, year and day. Check out books online for more information about the functions.

Also, remember that in most cases the server platforms that MS SQL Server runs on automatically corrects for daylight savings time on the OS level so this is normally not something that you have to worry about.


Dave