Newbe Question: Need A Way To Read In Large Query With .net

Feb 26, 2007

Could someone please point me in the right direction on how to read in
a large query with .net.

I am trying to emulate a legacy database system so I don't know the
upper bounds of the sql query. An example query would be something
like:

Select * from invoices where year 1995

the query must be updatable and only return say 10 to 100 rows at a
time.
It should also be forward only and discard rows no longer in use to
save memory.

And if at all possible I would like to lock one row at a time as the
row is read in.

View 5 Replies


ADVERTISEMENT

View And Print Contents Of Query Analyzer (was Big Time Newbe Needs Help)

Feb 28, 2005

Hello, I need some help, I am in school right now and I am in a SQL server class. We have been working in the query analizer making a database. Well I have to print out everything that I have typed. But I want to view it first. How do I do that?

Sorry I did a search and couldnt find anything.. Probably cause I dont really know what to search for or look under. Thanks for your guys time.

~Matt

View 2 Replies View Related

Read Large Binary Data From Sql Server 2005

Jul 14, 2007

Hi I've followed a tutorial on how to write and read varbinary(max) data to and from a database. But when i try to read the data i get the error that the data would be truncated, but only when the varbinary(max)  is greater then 8kB. I've used a system stored procedure (sp_tableoption) to set the table that holds the data to store data outside rows. To select the data i'm using a stored procedure:               SELECT imageData , MIMEType FROM Pictures WHERE (imageTitle = @imageTitle)        And then using an .aspx page to Response.Write the data:Using conn As New sql.SqlConnection            conn.ConnectionString = ConfigurationManager.ConnectionStrings("myConnectionString").ToString            Dim getLogoCommand As New sql.SqlCommand            getLogoCommand.CommandType = Data.CommandType.StoredProcedure            getLogoCommand.CommandText = "GetPicture"            getLogoCommand.Connection = conn            Dim imageTitleParameter As New sql.SqlParameter("@imageTitle", Data.SqlDbType.NVarChar, 200)            imageTitleParameter.Value = Request("imageTitle")            imageTitleParameter.Direction = Data.ParameterDirection.Input            getLogoCommand.Parameters.Add(imageTitleParameter)            conn.Open()            Using logoReader As sql.SqlDataReader = getLogoCommand.ExecuteReader                logoReader.Read()                If logoReader.HasRows = True Then                    Response.Clear()                    Response.ContentType = logoReader("MIMEtype").ToString()                    Response.BinaryWrite(logoReader("imageData"))                End If            End Using            conn.Close()        End Using  Can anyone please help me with this?!

View 2 Replies View Related

How To Read And Store A Large File From SQL Server 2000?

Feb 23, 2006

hi..
   I want to store a RMVB file to SQL SERVER 2000 ,and read from it,iwant to play the RMVB file in web,the size of the RMVB file is more than 300MB less 1G.the  SQL Field Image can include it.
Now My Quesstion is How can i Store and Read the RMVB file from SQL Server2000?
I used SqlInsertCommand.ExecuteNoquery()  in my program,but it Too slow,ao make a unknown error.
Thank you for your help.

View 6 Replies View Related

Newbe To SPs

Jan 19, 2004

Ey,
I need to do few operations on every record in a table. Do I have to use cursor? Do SQL has something like 'FOR' or 'WHILE'? I've read somewere that cursors should be avoided due to their time consumption.

Thnx

View 2 Replies View Related

MDX NewBe: MAX Of SUM GROUP BY

May 27, 2008

Hi.

I will try to abstract my problem to an example, simple as possible.

In a relational database exists 2 tables: Cars (containing car name and car id) and Costs (containing costs caused by cars - with columns like cost_id, car_id (fk to table cars), cost_category (something like 'buy', 'cleaning', 'maintenance'), cost_date and costs)


In the olap cube I've 2 dimensions: Cars and Costs and a measure sum(cost).
How can I create a measure containing the max value of the sum(costs) group by car_id?
In the SQL world it would be something like



Code SnippetSELECT
MAX(COSTS_PER_CAR)
FROM
(
SELECT
CAR_ID,
SUM(COSTS) AS COSTS_PER_CAR
FROM
tblCOSTS
GROUP BY CAR_ID
) AS TBL






But how can I realize it in MDX for using it as measure?

Thanks in advance.
Greetings.
Anatoli Rejditsch.

View 8 Replies View Related

Newbe To SQL2005 && MSDE

Aug 29, 2005

HELP!!having on trouble installing, just gettting everything connected.(xp sp2)First i loaded MSDE, then realized i needed the web admin tool to create the db...but can't get the web admin tool to connnect to anything..so I took a stab at SQL 2005 Std ed beta.....loaded fine, but then realized i need another admin tool to create db so I loaded the xpress manager...again, loads fine, but doesnt'connec to any DB..why is this so difficult for me.....SQL Svr v6 was so much easier with enterprise manager!!!HELP!!Don

View 1 Replies View Related

Newbe ? Re:date Format

Jul 8, 2004

Hi, I'm developing a page in asp.net using a sqldb and one of the values I'm sending to the database is a date/time value. I only want the table to show the date in short format, no time. Is there a way to restrict or convert the data in the table design mode?
Thanks
Raif

View 4 Replies View Related

Newbe Question About Replication

Aug 5, 2007

Hi ppl

I just started with all this 'replication' subject and run into some 'stange ?' problem. I suscesfully set-up publisher and distributor on one computer. create subscriber on another. And seems that this is working with no errors as I see in Replication monitor, details. All agent turned to verbose output and showing no errors at all. but the strange problem that the database does not (!) appear at subscriber (?????) I mean - no tables, no stored procedures, no nothing - how it can be possible ? What I'm doing wrong ? Or what I should do ?


P.S. Forgot to add: Both servers running latest SQL server 2005 with latest Service Pack. Subscribtion of type 'push'

View 1 Replies View Related

Displaying Database Results (HELP A NEWBE)

Dec 10, 2006

Hey All,
This is really simple basic question, and it's just so I can start to learn about MVS.
I have a sql-database called "Test" with a Table called "Agents" with just three colulms "ID", "FNAME" and "LNAME".
On the Default Page I have three Textboxes and a submit Button,
All I want to do is type "Select" criteria in Textbox1 and have Textbox2 Display the "Fname"  and Textbox3 Display the "Lname".
 (Using VB in ASPX)
Dim i As New SqlDataSource()
i.ConnectionString = ConfigurationManager.ConnectionStrings("Test").ToString()
i.SelectCommandType = SqlDataSourceCommandType.Text
i.SelectCommand =   ((((((Now What???)))))))
 
End Sub
PLease Help,  Thanks in advance
 A....

View 2 Replies View Related

Newbe Question: Calling Function Inside Select

Jul 20, 2005

Hi!I have a scalar function that returns integer:xview (int)Now, I'm trying to build a procedure that has the following selectinside:select atr1, xview(atr2)from tablenameBut, I get the 'Invalid name' error when I try to execute thatprocedure.If I got it right, I must use user.fn_name() syntax, but I cannot usedbo.xview() inside my procedure since it means xview will always beexecuted as dbo, which is unaccaptable.I'm a bit confused, so any hint is very welcomed.Thanks!Mario.

View 4 Replies View Related

Result Of Query So Large?

Feb 19, 2004

Hi all,
i have a problem ...
if there is a query that returns so many rows. I want to know where the result is stored? for example:what database?, what table?, what transaction log file?
Thanks fr reading.

View 3 Replies View Related

How Do We Tune A Large Sql Query

Feb 6, 2006

hi,I have a problem asked by one of my senior person and finding theanswer .What is the step by step procedure for tune a large sql query.OR how do we tune a large SQL query with somany joins

View 6 Replies View Related

Retrieving First N Rows From A Large Query

Feb 15, 2007

Sriram writes "Hi,

I want to retrieve only the first n rows from a query which returns a large number of rows.

Say,

select empno, name from emp where deptno=100

returns 1000 rows.

I want to improve the query so that it returns only the first 10 rows and not 1000 rows.

Thanks in Advance,
Sriram."

View 1 Replies View Related

Query Optimization Help For Very Large Tables

Nov 1, 2007

I have the following table structure:
tableA (~85,000 rows) primary key = [colA,colB]
tableB (~850,000 rows) primary key = [colA,colC]
tableC (~120,000,000 rows) primary key = [colA,colB,colC]

IMPORTANT: colC is DATETIME

For a SET of rows in tableA (about 50,000) I need to pull the MOST RECENT (given a date) corresponding values from tables B and C. The only way I can think of doing this is the following:

SELECT tableA.colA
,(SELECT TOP 1 colX FROM tableB WHERE colA = tableA.colA AND colC <= @INPUTDATE ORDER BY colC desc)
,(SELECT TOP 1 colY FROM tableB WHERE colA = tableA.colA AND colC <= @INPUTDATE ORDER BY colC desc)
,... --some more columns from tableB
,(SELECT TOP 1 colX FROM tableC WHERE colA = tableA.colA AND colB = tableA.colB AND colC <= @INPUTDATE ORDER BY colC desc)
,(SELECT TOP 1 colY FROM tableC WHERE colA = tableA.colA AND colB = tableA.colB AND colC <= @INPUTDATE ORDER BY colC desc)
,... --some more columns from tableC
FROM tableA
WHERE tableA.colX = 'some criteria'


Is there any other way anyone can suggest? Unfortunately, because tableC is so large, the disk IO (I think) causes this query to take over an hour. (If I had monster RAM and super fast disk this wouldn't be as big an issue, but that's not an option right now )

Thanks in advance!

View 7 Replies View Related

Large Long Running Query

Mar 20, 2008



The query show below is designed to use seasonal profiles to compute 53 weeks of forecast data and then from that compute the number of weeks of supply of each item at each location. The query works but the volume of data produced (20+M rows) is substantial. If I limit the CTE to a single location, it run is 2 seconds and returns 41,000 rows. But when run for all locations and items, it runs for more than 4 hours. Would I do better converting the CTE to a sub-query and adding an index to improve the performance of the main query?


WITH Forecast AS

(SELECT Location_Idx

,Item_Idx

,Week_Code

,(CAST(AnnualQty AS DECIMAL(9))/53.0)*[Profile] AS fcst

FROM dbo.FactReplenishmentProfile rp

INNER JOIN dbo.FactSeasonalProfile sp

ON sp.SeasonalProfile_Idx = rp.SeasonalProfile_Idx

)

SELECT fcst1.Location_Idx

,fcst1.Item_Idx

,fcst1.Week_Code

,fcst1.fcst AS WeekQty

,SUM(fcst2.fcst) AS CumQty

FROM Forecast fcst1

INNER JOIN Forecast fcst2

ON fcst2.Location_Idx = fcst1.Location_Idx

AND fcst2.Item_Idx = fcst1.Item_Idx

AND fcst2.Week_code <= fcst1.Week_Code

GROUP BY fcst1.Location_Idx,fcst1.Item_Idx,fcst1.Week_code,fcst1.fcst

View 4 Replies View Related

Limiting Large Query Results Sets

May 22, 2000

We are trying to limit are query that returns items from our database. The
query currently returns 32,000 records. We are trying to figure out an effecient way so we can request the 1st 50, or the 3rd 50, or the 5th 50 to display to the screen. We dont want to return the entire 32,000 then limit whats displayed to the screen in ADO. We want the select statment to only return 50 at a time. Any suggestions?

View 1 Replies View Related

Large Database, Slow Query Speed. Help!

May 29, 2008

Hi guys,

I am asking this question on behalf of a friend. I have little knowledge of SQL 2005 but my friend is quite knowledgeable, although this is the first time he is dealing with large database for a client. So here's the story.

His client has a database containing 1.5 million books. Now he is setting up a website which will enable users to search books. Searching by ISBN is no problem as it only takes 1 seconds. The problem is, searching by Title takes more than 20seconds, which is unacceptable. My friend has only done smaller database and he just recently thought of implementing indexing and now looking for other ideas.

Each row contains book details such as Title, Author1, Author2, Author3, Publisher, Publication Date, ISBN, etc.

Can anyone who are more experienced in doing large database share with me some design ideas? His client is aiming for 8seconds or less.

Thanks in advance!

View 14 Replies View Related

Large Table/slow Query/ Can Performance Be Improved?

Jul 20, 2005

I am having performance issues on a SQL query in Access. My query isaccessing and joining several tables (one very large one). The tables arelinked ODBC. The client submits the query to the server, separated byseveral states. It appears the query is retrieving gigs of data from thetable and processing the joins on the client. Is there away to perform moreof the work on the server there by minimizing the amount of extraneous tabledata moving across the network and improving performance (woefully slowabout 6 hours)?

View 3 Replies View Related

Error Msg While Running Relatively Simple Query (large Result Set)

Jul 17, 2007

While running query below on SQL Server 2005 (Build 3790: Service Pack 2):



SELECT DISTINCT pkg.PrimaryBarcode

FROM dbo.Package AS pkg (NOLOCK)

JOIN dbo.PackageCycle AS pc (NOLOCK)

ON pkg.PackageKey = pc.PackageKey

WHERE (pkg.BillCycleDateKey >= 20061201) OR

(pkg.BillStatusKey = 1)



I received a partial result set followed by

An error occurred while executing batch. Error message is: Couldn't replace text



I suspect this is a memory issue, but cannot find any reference to this particular msg on the Microsoft forums or the other 3rd party forums. PrimaryBarcode is a varchar(50)



I am not sure where to go from here. I would appreciate any ideas. Thanks in advance.



Cheers,

Mike Byrd

View 2 Replies View Related

Fulltext Large (500.000) Count Query Performace Too Slow

Feb 14, 2008

Hi,

I am with the response time for a simple count on a fulltext search that is too slow.

Even using the most simple query on a good server (64 bit Dual Opteron 4GB Ram with high speed 16 raid disk storage)):

select count(*) from content_books where contains(searchData,'"english"')
Takes 4 seconds to count the avg 500.000 resultsI have removed all the joins with real table data so that the query is only inside the fulltext engine..

I would expect this to be down to 4 milli seconds. Isn't it just getting the size of the "english" word result index?

It seems the engine is going through all the results because if a do a more complex search that returns less results the performance is better.

Any clues of how to do this faster? I never read the thousands of records BUT i need to count them...

Thank you very much.

View 2 Replies View Related

Read XML Node Elements Using Query

Dec 29, 2011

I am having the example xml with the data as shown below,

declare @x xml
set @x = '<SinterklaasWishlists>
<child>
<name>Tim</name>
<wishlist>
<article>
<artno>21491269</artno>

[Code] ....

I want to extract the elements of xml using sql query and insert the data into the table as shown below:

CHILDNAME ARTICLE_NUMBER DESCRIPTION PRICE
------------------ ---------------------------- ----------------------------------- -----------
Tim1 21491269 Crane 12.50
Tim1 21499517 Keyboard 10
Tim1 21521591 Crime Investigation Game 9.95
Tim2 3145678 Mouse 12.50

View 2 Replies View Related

Read File Size In Sql Query

May 23, 2008

hi
how can read file size in sql query

View 2 Replies View Related

Query/read Database Size?

Jul 20, 2005

I have a web-based admin section for a site and I would like to be able toquery the SQL Server database size and display it within my admin area. Isthere a function or method of doing this? My database is hosted by a thirdparty...I appreciate any tips or advice you can provide!Rob

View 5 Replies View Related

Password To Read/write My Query

Feb 6, 2008

I use excel as an interface to write query to retrieve data from a database in network drive. My problem is everyone can open and edit my query. Of course, the univeral database access user name and password will ask but everyone know this.
How can I put password to prevent any query modification?

Thanks
Daniel

View 1 Replies View Related

Timeout Problem With Large Update Query From VB.Net To SQL Server 2000

Jul 20, 2005

Hi all,I am doing some large updates,that may update 10,000 plus rows.This works fine when I execute the SQL directlyin Query Analyzer.If I set the timeout on my VB connection to 0 (zero)the connection should not time out????But it does.If I set the time out to a high value, say 1200,I get the same problem well within 1200 seconds.Also, I am getting the problem that the log fills up,but it is set to auto grow????Any ideas would be appreciated.ThanksGreg

View 1 Replies View Related

System Drive Problem Caused By Query Against Large Table

Jun 26, 2007

Hi, all experts here,



Thank you very much for your kind attention.



It's so frustrated that I dont really knwo what is going on and why is that and I have tried ages to try to figure it out and nothing really helps.



I have already moved the data files of tempdb database to a drive with enough space (many GB space left still), but then again I got the problem which run out all of the system drive space when I run a query against a large table? Why is that? And how to figure it out?



Please help me and thanks a lot in advance for your kind advices and help and I am looking forward to hearing from you shortly.



With best regards,



Yours sincerely,



View 1 Replies View Related

How Can I Read Type Of All Fields In Joined Query?

Nov 29, 2007

How can I read type of all fields in joined query?
Is there a stored procedure method to use for this purpose?
 
Thanks

View 3 Replies View Related

Query Highest Entries From Database - Pls Read More.....

Feb 6, 2006

Hi folks, sorry for the poor explanation.

Im using SQL 2000

I have a database that has a column named 'Initials' in a char in field

I want to be able to return in a query the highest entries if an indiviuals initials & count from the table, so it would display some like this

Initials Count
DRT 51
AMS 49
JJJ 21
PLI 10

Hope u can help, thanks in advance

View 2 Replies View Related

OLE DB Command... Read Returned Fields From Query...

Apr 16, 2007

Dear Friends,

I have an OLE DB Command inside an ETL. I want to execute a stored procedure that returns 2 fields, for example:





CREATE PROCEDURE sp_Name

AS

SELECT Field1, Field2 FROM Table





How can I continue the dataflow? How can I return the values from the query? Returns only a row...

View 10 Replies View Related

How To Read The Xml Returned By Select Query With For XML Auto,Elements

Dec 13, 2007

Hi all,
 I am writing a select query which produces huge xml data.Now i want to read that data from my web application a save it as xml file.
How can i do that.
I am using asp.net vb.net.

View 1 Replies View Related

No Response To Code And Query Analyser Cannot Read Statement

Feb 20, 2004

hi

have a problem ...
I tried to test my statement in QA as it returns no dataset ,it gives me empty columns in return,I though it will return all the columns and some records of (lmeyer) as the current user ,who logged in on windows auth,but it return only the columns,is that means my query analyser cannot read the login1 ,column which has the username as (lmeyer)

select * from tstudents where (login1='@param1')

if not what could me wrong in my code ,because I get no response to the sql server




Public Function login(ByVal login1 as string) as dataset

Dim myconnection as new sqlconnection("server=G103-TT03;database=CampusLANDB;Trusted_Connection=yes")
dim mycommand as new sqlcommand ("Select * from tStudents Where login1 = @param1",myconnection)
mycommand.parameters.add(new SQLClient.SqlParameter("@param1",login1))

dim DS as new dataset()


try
myconnection.open

dim adpt as new sqldataadapter
adpt.selectcommand = mycommand
adpt.fill(DS,"tStudents")


catch ex as exception
throw new exception(ex.message)
return nothing
finally
myconnection.close
end try

try
mydatagrid.datasource=DS.Tables("tStudents")
mydatagrid.databind()
catch ex as exception
errorlabel.text=ex.message
end try

return DS

End Function





thankx in advance
pamela mkosana

View 12 Replies View Related

SQL Server 2008 :: Query To Read From Each Column Of XML Tags?

Jul 31, 2015

The below query will read the data in XML format but any query to read from each column of XML tags easily?

SELECT CAST(record AS XML), record
FROM sys.dm_os_ring_buffers
WHERE ring_buffer_type = 'RING_BUFFER_CONNECTIVITY'

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved