Best way to query data with varchar (max) cloumn.

Hi,
I have joined  three table and selected 15colmuns over a period of 6months it tooks 10sec .
I selected two more columns with varchar(max) datatype it took me 60sec.
whats the best way to select varchar(max) over a period?
Can anyone please help me on this?
Thanks,

I have joined  three table and selected 15colmuns over a period of 6months it tooks 10sec .
I selected two more columns with varchar(max) datatype it took me 60sec.
That appears to be normal behavior for any RDBMS.
You can use the LEFT function to limit transmission volume from server to client:
SELECT A.Title, A.DocumentSummary INTO tempdb.dbo.DocText
FROM Production.Document A
CROSS JOIN Production.Document B CROSS JOIN Production.Document C
CROSS JOIN Production.Document D CROSS JOIN Production.Document E;
-- (59049 row(s) affected)
SET STATISTICS TIME ON
DBCC DROPCLEANBUFFERS
SELECT A.Title, A.DocumentSummary FROM tempdb.dbo.DocText A
DBCC DROPCLEANBUFFERS
SELECT A.Title, Prefix=LEFT(A.DocumentSummary,10) FROM tempdb.dbo.DocText A
SET STATISTICS TIME OFF
SQL Server Execution Times:
CPU time = 172 ms, elapsed time = 787 ms.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
(59049 row(s) affected)
SQL Server Execution Times:
CPU time = 62 ms, elapsed time = 560 ms.s.
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

Similar Messages

  • Best way to export data with r.t. prompts and have dense dim mbrs on rows?

    Hi All-
    What is the best way to export data with Run time prompts out of Essbase?
    One thought was to use Business Rules with run time variables and DATAEXPORT command, but I came across at least one limitation where I cannot have months (part of dense Time Periods dimension) on rows.
    I have only two dense dimensions: Accounts and Time Periods and I need both of these on rows. This would come handy when user enter Start and End month and year for data to be exported e.g. If start period is Feb 2010 and end is Jan 2011, I get data for all months in 2010 and 2011.
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000",14202.24,14341.62,14560,13557.54,11711.92,10261.58,12540.31,15307.83,16232.88,17054.62,18121.76,18236
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000",19241,21372.84,21008.4,18952.75,23442.13,19938.18,22689.61,23729.29,22807.48,23365,23915.3,24253
    "CORP1","0173","FY11","Working","Budget","Local","HSP_InputValue","404000",21364,22970.37,23186,27302,25144.38,27847.91,27632.11,29007.39,24749.42,27183.39,26599,27112.79
    where ideally I would need to get the following:
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Feb",14341.62
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Mar",14560
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Apr",13557.54
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","May",11711.92
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Jun",10261.58
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Jul",12540.31
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Aug",15307.83
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Sep",16232.88
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Oct",17054.62
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Nov",18121.76
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Dec",18236
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Feb",21372.84
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Mar",21008.4,
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Apr",18952.75
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","May",23442.13
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Jun",19938.18
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Jul",22689.61
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Aug",23729.29
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Sep",22807.48
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Oct",23365
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Nov",23915.3
    "CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Dec",24253
    "CORP1","0173","FY11","Working","Budget","Local","HSP_InputValue","404000","Jan",21364
    Thank you in advance for any tips.

    Have a read of the following post :- export data to sql
    It may give you a further option.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Best way to export data for a migration

    Hi Oracle Community,
    What's the best way to export data from an Oracle 8i database for it to be suitable for import into an Oracle 10g database?
    What's the best way to export data if it is to go into different rdbms database?
    Thanks, David

    Thanks everyone for all your help. You guys are great.
    There seems to be many good ways to export your data from Oracle into a flat file format, suitable for import into other RDBS': Oracle, mysql, postgresql, etc.
    A few tools where mentioned but using SQL*Plus, which comes with Oracle (And SQL*LDR on the backend, which also comes with Oracle) seem the most straight forward.
    I found this script on asktom.oracle.com to work great, slightly modified here,
    (to Include linesize max, and pipes rather than commas):
    set echo off newpage 0 space 0 pagesize 0 feed off head off trimspool on
    set linesize 32767
    spool payment.txt
    select
    PAYMENT_ID||'|'||
    USER_ID||'|'||
    <more fields her>
    from
    payment
    spool off
    exit ;
    It works great. Rather than making one of these for each table I wrote an perl script called ora_export. http://crowfly.net/oracle/ora_export. It runs in Unix and only requires SQL*PLUS. It creates these four files:
    <tablename>.def # list of table columns and types (SQL*Plus DESC)
    <tablename>_dump.sql  # a script to export the data
    <tablename>.psv # THE DATA (eq. - name|address|etc)
    <tablename>_load.ctl  # SQL*LDR control for ORCL if you need it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • What is the best way to consolidate data on two Macs?

    Hi All,
    About to embark on a small project to move all my data on to my MacBook before finally saying goodbye to my trusty iMac.  In order to do this I'll be upgrading the HDD on the MacBook to a large one and using Time Machine to restore all the original data onto the new drive.  This bit I'm good with as I did it before when I upgraded the drive on my old iMac. 
    The main problem I have is that the majority of my photos, music, videos and documents are on my old iMac and I'd like to discuss the best way to merge these with a smaller amount of data that the MacBook has on it.  Both machines are running Snow Leopard and I'm not aware of any tools that are currently available to do something like this although I am aware that Lion is supposed to have features that would consolidate everything to the cloud and might make things quite easy.  This is something I would be willing to spend the £30 or so doing so if anyone has any experience of using Lion to merge everything across Macs to the cloud please let me know if you feel this would be a suitable approach.
    Just to summarise the state my data is in currently and the approach I currently intend to take. 
    Have the Mobile Me service so Mail, Address Book, Calendars and all that stuff are all synced across both machines anyway. 
    Applications - Some stuff on the old Mac that I no longer user but nothing here that I really want to migrate.  Some specific application stuff is mentioned below. 
    Movies - This is the bit that I'm most concerned about.  Have a lot of legacy iMovie stuff on the old iMac which I'd like to keep.  iDVD as well.  Not sure of the best way to get this across and maybe it even warrants a separate discussion. Aside from that most of my older video stuff and projects are on the iMac with the newer stuff on the MacBook.  I'm unaware of any function to export and import this but I have a large HDD which I can use to copy stuff over and am going to look into this a bit further.  There will be a small amount of duplication here but this is manageable. 
    Documents - Will just copy these across and organise them as and when I need them.  Again, a small amount of duplication but this is manageable. 
    Music - Pretty much all my stuff the old iMac.  Can just export this and copy it onto the MacBook. 
    Pictures - Bit complicated this.  Most of my stuff on the old iMac but some newer albums on the new MacBook.  No duplication so presuming I can just export the library off the old iMac and import it on to the new MacBook. 
    No websites or anything like that. 
    iPhone currently syncs with iMac but once I have all the stuff over it should not be too hard to change this. 
    Just my user account on each machine that I really want to keep.  Shared documents and other users accounts all contain temporary stuff that I'm happy to lose or archive. 
    Given this is anyone able to offer advice as to 1) Whether this is the best approach? 2) Have I considered everything? 3) Are there any tools that might help me?
    Many thanks,
    Tom

    OK, seeing as no-one replied (presumably because a lot of this information is on the forums in bits elsewhere) here's how I've got on so far.
    Applications - just went through them.  About the only one I needed was my media server app.  Just downloaded and re-installed, had a quick look back though my email to find the license key and it all went on fine.  Installation never seemed quite right on my old machine so solved that problem too. 
    Movies - New iMovies just copied across the clips and projects into their respective folders.  Seems to have worked but haven't checked it all that thoroughly.  Some duplicate footage here but I can trim this out at some point when I get a chance to go through here. 
    Documents - Just copied these across. 
    Photos - used an app called iPhoto Library Manager.  You can download for free but have to pay to use the part that consolidates your libraries.  Possibly if I was willing to spend a bit more time I could have got away without using this but given I didn't know the state of my different libraries and just how many duplicates I had this was too much of a convenience to ignore.  Also got my library into a state where I can now spend a few hours organising it a bit better with Faces / Events etc. 
    Not attempted Music or iPhone sync yet as been stuck trying to solve a problem with my power adapter. 

  • Best way to import data to multiple tables in oracle d.b from sql server

    HI All am newbie to Oracle,
    What is the Best way to import data to multiple tables in Oracle Data base from sql server?
    1)linked server?
    2)ssis ?
    If possible share me the query to done this task using Linked server?
    Regards,
    KoteRavindra.

    check:
    http://www.mssqltips.com/sqlservertip/2011/export-sql-server-data-to-oracle-using-ssis/
          koteravindra     
    Handle:      koteravindra 
    Status Level:      Newbie
    Registered:      Jan 9, 2013
    Total Posts:      4
    Total Questions:      3 (3 unresolved)
    why so many unresolved questions? Remember to close your threads marking them as answered.

  • Most efficient way to query dates

    Hi!
    Just wondering if anyone know the quickest or best way to to date comparisons with Oracle. Ie does it take longer for oracle to convert the input date from the inputted date to a date it can use to compare. eg
    iuser.CreateDate <= to_date('07:Dec:2004:11:59:59:PM', 'DD:MON:YYYY:HH:MI:SS:AM')
    OR
    iuser.CreateDate <= to_date('07:12:2004:11:59:59:PM', 'DD:MM:YYYY:HH:MI:SS:AM')

    Hello,
    I have two comments:
    a) what about to use only "<" operator with next day instead of "<="
    iuser.CreateDate <= to_date('07:Dec:2004:11:59:59:PM', 'DD:MON:YYYY:HH:MI:SS:AM')
    iuser.CreateDate < ('08:Dec:2004', 'DD:MON:YYYY')
    b) I think that more faster could be passing the comparision date as date parameter iuser.CreateDate < :inp_test_date.
    sasa

  • Best way to read data sources in parallel

    Hi,
    I'm looking for conceptual help as I start a project. I am trying to figure out the best way to get data from several sources at different timings and deliver them to a main vi.
    I have 4 systems, which each work well on their own (OK, one doesn't work yet, but let's assume that can be fixed
    One system reads from 2 pH meters on serial ports. The meters are slow to respond, so it takes about 2 minutes to read 4 channels of data. I save these data to a file every 10 minutes
    One system reads from a CO2 meter on the USB port. It reads the data every second, and does some averaging. Every 2-10 minutes, it saves the average to a file and then sends a command to the parallel port to switch the input to the meter.
    The third system reads from 6 valves, each on a serial port. These also take time, probably several minutes to poll all 6. These data will also be saved to a file.
    The 4th system reads a bank of temperature probes on the USB port. These get polled every few seconds and saved to a file every few minutes.
    Now that these individual routines are working, I am trying to create a front end that will display all the data in one place and allow me to set all the parameters from a single place. I would also like the possibility of using the data from one source at another place (for instance, having the output of the temperature probes sent to the pH meters to adjust their calibration). At this point, I get confused as to the best way to proceed.
    It seems like if I just want to read the data from each source, I could simply put all 4 routines together in a single vi (oh, what a mess that would be to read). Maybe I should start this way?
    However, if I want to have any communication between the different data sources, it seems like I will either need to use queues or VI server. I sort of envision a vi that lets me configure the various ports and the file operations and then can turn on monitoring of any or all of the various inputs. Each of them will do their thing at their own time and the main routine will simply display whatever data they deliver whenever they have new data. Fortunately, nothing is particularly time-critical, nor does it need to run fast.
    My questions: Am I correct in how I'm thinking about getting this to work?   Is there a clear choice between queues or vi server? I've looked at several examples of each, but without having done something like this before, it is hard for me to tell which is better.
    Thanks for any suggestions.
    mike

    Hi Mike,
    I think that you are on the right track with your thinking process. You might be able to implement this using queues. I'm not exactly sure how you would do it with VI server since it is just a set of functions that allows you to dynamically control front panel objects, VIs, and the LabVIEW environment. However, there are some great resources available with using queues for this type of application. I'm including the link to another discussion forum that had a very similar question to yours. There is a good example of using queues within this forum post. Also, there is a great example in NI Developer Zone about using queues and some other good ones in the NI Example Finder (just search 'queues' and you should get a few results). I hope this helps!
    Carla
    National Instruments
    Applications Engineer

  • Best way to pass data sets to another program

    Hey
    I want to connect another (maths) program with my java application. Therefore I need to paste data (some kind of tab separated table) to this program.
    I try now to save these data in a separate newly generated file and to pass a command with Java's Runtime.exec() method to this program to read these data. Is this a good idea or might there be better ways?
    If I do so, is there a way in Java to generate some kind of a "temporary" file which will be deleted automatically after usage or is this nothing else than to save it in a common file and delete it afterwards. What's the best way to pass data generally?

    Well, the connection will not be over a network, so I'd rather think it's not a Socket or RMI problem (unless someone convinces me).
    Yes it's very external, it's a C or C++ written program, I don't have any source codes. So far I generated a file for Input command and data, I passed that on to the maths program and returned the output into another file.
    Now I would like to separate the output and like to obtain some tables and graphical things like charts at the output. Do I have to generate three different types of outputfiles? How to store some graphics e.g. some distributions. I thought even of generating a database. I never thought about XML, I don't know if this works for that kind of problem?!

  • Best Way to Load Data in Hash Partition

    Hi,
    I have partitioning by Hash on a Large Table of 5 TB. We have to load Data say more than 500GB daily on that table from ETL.
    What is the best way to Load data into that Big Table which has hash Partition .
    Regards
    Sahil Soni

    Do you have any specific requirements to match records to lookup tables or it just a straight load - that is an insert?
    Do you have any specific performance requirements?
    The easiest and fastest way to load data into Oracle is via external file and parallel query/parallel insert. Remember that parallel DML is not enabled by default and you have to do so via alter session command. You can leverage multiple CPU cores and direct path operation to perform the load.
    Assuming your database is on a linux/unix server - you could NFS load the file if it is on a remote system, but then you will be most likely limited by network transfer speed.

  • Best way to extract data from archived cube

    Hello Experts,
    Can anyone tell me best way to extract data from archived cube.
    Basically I am trying to pull all the data from archived cube and then load it into another brand new infoprovider which is in different box.
    Also I need to extract all the master data for all infoobjects.
    I have two options in my mind:
    1) Use open hub destination
    or
    2) Infoprovider>display data>select the fields and download the data.
    Is it really possible to extract data using option (2) if records are too high and then load it into another infoprovider in new system.
    Please suggest me the pros and cons for the two options.
    Thanks for your time in advance.

    Hello Reddy,
    Thanks a lot for your quick reply.
    Actually in my case I am trying to extract archived infocube data and then load it into new infoprovider which is in different system. If I have connectivity I can simply export data source from archived infocube and then reload into new infoprovider.
    But there is no connectivity between those two systems (where archived cube is and new infoprovider) and so I am left with the two options I mentioned.
    1) Use Open Hub
    or
    2) Extract data manually from infoprovider into excel.
    Can anyone let me know which of the two options is the best and also I doubt on how to use excel in extracting data as excel have limit of no.of records 65536
    Thanks
    Edited by: saptrain on Mar 12, 2010 6:13 AM

  • Best way to move data and programs to another profile on same Mac?

    Hello,
    What is the best way to move data and programs to another profile on the same Mac? I have a user who's profile is corrupt, I know that most programs will work on both the new and old profile however when trying to copy the Desktop folder, or Documents folder I am getting permissions denied.
    Sort of like weeding a garden, I'm hoping I do not have to pick the data in each folder and copy individually.
    Thanks for your help!
    Johnathon

    This usually means that a configuration or preference file is corrupted.  In this user's /Home/Library/Preferences/ folder locate any preference files associated with iLinc and drag to the Trash.
    I would also check in the /Home/Library/Caches/ folder for a file or folder associated with iLinc and delete as well.
    See if the problem is resolved in the user's normal account.
    It's not that you cannot copy data from account to account, but doing so causes a lot of permissions issues that must be resolved.  The MacFixit article I linked above shows what you need to do after transferring from one account to another in order to change permissions on the "foreign" files to those of the destination account.

  • Best way to transfer data between loops?

    Hi, whats the best way to transfer data between loops(state machines, regular while loop etc) in labview. For so many years ive been using local variables but these can cause race conditions. Anyone advise?
    Stu

    It depends one the structure of the loops and how they need to exchange data (unidirectional, bidirectional, broadcasting).
    The simple case of one loop passing data to the other loop: producer/consumer design pattern using a queue
    If the structure already contains an event structure: User Events
    The way I code is documented in my community nugget on events
    I often mix this with producer/consumer.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • Best Way to Save Data

    Hi all, I'm relatively new to Java, and have a quick question.
    What is the best way to save data in an application, and what is a good rule of thumb when to dive into a database to hold the information. For example a directory of people and their information. I want the program to be able to add/update/delete the information with ease.
    I was reading in Core Java Vol II how to save object data to a file, but it seems tedious if I have to run through a list of objects and save each one. I just want to be able to save records, and retrieve them to edit later.
    Thanks in advance,
    \\//

    UnknownSector wrote:
    Hi all, I'm relatively new to Java, and have a quick question.Hy there, when you find some time, go read [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html], it will help you in the future.
    What is the best way to save data in an applicationThere is almost never a "best way" to do anything. At least not if you don't define your requirements exactly. It depends on tons of things, that's why there are so many ways to "save data".
    Writing to files and saving to databases are just two of those, and even among those, there are thousand of different ways to handle it.
    , and what is a good rule of thumb when to dive into a database to hold the information.When the data is structured and you want to do queries on it, then you can probably look into a database. When the data is structured and you've got lots of it, then you really should look into databases.
    For example a directory of people and their information. I want the program to be able to add/update/delete the information with ease.Too little information, but I'd tend to go with a database. But then again, I'm going for a DB rather quickly.
    I was reading in Core Java Vol II how to save object data to a file, but it seems tedious if I have to run through a list of objects and save each one.I don't know what exactly you're talking about. Are you talking about serialization? What makes you feel that it is tedious? Can you describe it?
    I just want to be able to save records, and retrieve them to edit later.Well, that can be done in many, many ways. That alone doesn't force you to go one way or another. It's pretty much the definition of "save data".

  • Best way to hold data

    Hiu guys,
    I would just like to know your opinions on the best way to hold data.
    The data is in the following form,
    ProcessNo PageNo
    eg
    0 0
    0 4
    0 3
    1 5
    1 4
    etc
    I was thinking of using a two dimensional array but would it be better to use a linked list or an other way? Can you store two items in the same list position?
    Thanks in advance

    I would add something to what the previous poster said.
    You could also make it an example of a Property Bag pattern and abstract the properties to a container (for example a Hashtable) which would allow you to expand the property list more easily. As with most things, there's an up side and a down side. The up side being that if you get new properties, or have to take properties away you can do so more easily (with less invasion of the existing code). The downside being that there's a bit more work to do at the start.
    The question to ask is how much of this do you have to do? If you're only doing it for example for homework and you won't be using it any more, it's not worth the effort. Likewise if your property list won't ever (or hardly ever) change it becomes less workable unless you have lots of them to do. But if your environment is more volatile or you have lots of it to do for your project it becomes a viable way of doing things.

  • Best way to control voltage with my code?

    I need to be able to control current and voltage of a power supply. What would be the best way to implement this with my code? I realize that I need to use a DAQmx Start and Stop task. I *think* I would like the task to start when the user runs the program. The voltage and current should be 0 when I start it, or a really low number.
    Currently, the program I am working off of using TraditionalDAQ. It uses 'AO Write One Update.vi' to update the voltage and current. 
    How can I use DAQmx to achieve the same? Is it possible to also have the DAQmx code in an event structure in the same way?
    Can I do this in my event structure, in a new event? The code below shows my code. There are two loops, the bottom one handles acquisition and logging. The top one handles the events.

    There are an excellent series of NI Tutorials on DAQmx.  Not that they are easy to find, but start here:  DAQmx White Papers.  This is an especially useful White Paper:  The Top 10 DAQmx Functions.
    Something that also helps a lot is to configure your device using MAX (and use MAX to run it to be sure it is working correctly).  Once you have it configured, save it as a Task, which encapsulates all of the "picky details" (such as channel names/numbers, sampling rates, clock sources, etc.).  When you go to write your code, simply right-click on the Start Task VI and create a constant, expand the Constant (which should show you MAX's Tasks), and choose the Task you just created.  No need for numerous confusing DAQmx Configuration VIs.
    Bob Schor

Maybe you are looking for

  • Error in Excise JV Creation

    While passing JV for ECSS in the TCode J1IH we are getting an error. We find The <b>MODVAT GRN ACCRUAL CLEARING-INPUTS & CAPITAL (G/L Account No : 102112)</b> being debited but there is no corresponding credit entry . There is no provision to enter t

  • Reference to record

    Hi, I have problem with referencing to record of table. Could you help me, please. I have two tables: tab1(PK_tab1,something) and tab2(PK_tab2,FK_pk_tab1,somethingelse) relation tab1.pk = tab2.FK_pk_tab1 On 1st page(report) is displayed by select * f

  • Selection screen doubt

    can anyone help on this:- i hav tables pa0000, pa0001, pa2001. my selection screen:- parameters : S_BTRTL LIKE PA0001-BTRTL,              s_month like      ? how should i get month in the selection screen? i am callig fun module:-REAL_ESTATE_F4_MONTH

  • Geen bar detecting signature field

    This happened to me too the documents that I open do not have any signature fields. It effects Reader and Adobe XI pro as they both updated recently to 11.0.3. I spoke with support I uninstalled, cleaned and reinstalled but as soon as it updated to 1

  • Repeated events not showing on the correct dates.

    Hi, In 2009 I set a number of events to reoccur yearly. This year I have found that every event is a day out. This means I have to manually go through each one and correct it. Why is iCal doing this. Surely it should match the date for the following