.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Sum the results from three different tables into a text box.

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :Sql Server

I have three tables.  All three tables use the same data set but filter the dataset differently.  How can I sum a box from the three tables into a textbox?


View Complete Post

More Related Resource Links

DropDownList to display values from Two Tables - bold sub heading and normal Text

Hello I hope I am not asking simple one.  SUPPORT SERVICES<     Computing Service    Library or Data Engineering    Civil Engineering    Electrical Engineering  I have the data to display in a DropDownList control shown as above. There is a distinct category Type(example Support Services) and Category Name i.e., Computing Services. I do not want to hard code the values into DropDownList control. I like to get the data from database to display as shown in above Table. Note that Category Type should be displayed in Bold and Category Name in normal Text. Question: In order to achieve the above, 1. How many database Tables and relationships between them  2. Query the data to display in the above format in drop down 3. how should be the code behind i.e, DataTextValue and DataValueField for DropDownList. Please provide with useful code snippets or references. Thanks,

Saving SSIS results to Log or text file using dtexec

Hi, How to save the SSIS package results to log file using dtexec command............please help regaridng this...........   Thanks in advance,

How to create a SSIS package to import records form SQl Server 2008 tables to text files

I am a newbie to SSIS and would like to create a package to accomplish the task referenced in the above title. Will appreciate any links and pointers in the right direction.   Thanksakoranteng

Does a Maintenance Plan "Rebuild Index" task on Tables + Views rebuild the full text indexes ?


As subject really.

I'm talking about a complete rebuild - not an incremental, or a re-organise.

SQL 2005

The full text indexes are only on individual tables, not Views.

I've asked a similar question before, but sufficiently different, and other is marked as Answered so thought I'd open a new Q : http://social.msdn.microsoft.com/Forums/en/sqltools/thread/5f17f4f1-fba9-436f-aedf-cfbfd89c8db2)


Two results from two different tables by Stored Procedure and put them in variables and send email.


Hi All, first i had like 7-8 steps just to execute stored proc and send email. now i have put everything in one stored proc as follows :

Alter procedure PlanFinder.InsertInvalidRecords

Truncate table [PlanFinder].[InvalidAwps] 
INSERT INTO [PlanFinder].[InvalidAwps](Ndc, AwpUnitCost) 

SELECT DISTINCT P.Ndc Ndc, A.Price AwpUnitCost 
    PlanFinder.PlanFinder.HpmsFormulary P 
    LEFT JOIN (SELECT Ndc, Price FROM MHSQL01D.Drug.FdbPricing.vNdcPrices  
               WHERE PriceTypeCode = '01' AND CurrentFlag = 1) A 
ON P.Ndc = A.Ndc  
WHERE (A.Ndc IS NULL OR A.Price <= 0 OR A.Price IS NULL) 

DELETE FROM PlanFinder.NdcAwp
       Ndc IN
              SELECT Ndc
              FROM  PlanFinder.InvalidAwps                     &nb

INSERT the Results of a Stored Procedure with Multiple SELECT Statements into Multiple Tables?

I have a stored procedure (which is overly complex and written by someone else) that I need to take the results of and put them into tables.  The stored procedure uses Dynamic SQL to build and then run 5 SELECT statements based on literally hundreds of variables.  I need to take the results of these SELECT statements and put them into tables in a different database.  Rewriting or re-creating the logic of the stored procedure is NOT AN OPTION as the logic may change over time and maintaining it in multiple places would be nightmarish.  Can anybody help me with this?  I've googled extensively, but have only been able to find examples of using one result set not multiple ones.

Formatting search results -- is there any good way to flip colors on text being searched for?


I have a mobile website that allows you to search on three different criteria and dsiplay the results in a gridview.  I thought it would be easy to modify it so that when the results are displayed, the field that was searched would display the sought text string with the colors reversed, as is the style for so many search engines.  So I began modifying the rowdatabound() event, searching the relevant field for the search string, sandwiching the search string inside a <FONT> block with the reverse colors wherever it was found, and assigning the result back to the control that the field was bound to.

I don't seem to be having much luck.  No matter what kind of control I use -- which includes textbox, label, and literal, all I can ever get is a BLANK where the reversed-colors text is supposed to be.  If I use the <FONT> block with the normal colors, I can still see the text, but if I try to reverse them (or use different colors), all I can get is the blank space.

So to state the problem succinctly:  Using the rowdatabound() event, you want to display a block of text inside of a conrol inside of a gridview with one word displayed in the reverse of the normal foreground and background colors.  What kind of control would you use?  (Note: The field

How to output data from master detail tables into text file but on different lines.



I have a requirement to output data from two tables, a master table and a detail table, to a text file such that the output looks like the following:

master record 1

detail record  1 1

detail record   1 2

master record 2

detail record  2 1

master record 3

detail record 3 1

detail record 3 2

detail record 3 3



Is this possible in one query?  I am sufficiently familiar with the bcp utility to do the output from any of the tables separately but have some difficulty with doing it for the two tables and have the result structured as outlined above.

3 tables, different schemas, going to 1 text file


We have three tables, each with different schemas, and we want to base a new output text file on them. We want to use the top record in table 1 as a header in the new text file, the entire body of Table2 as the "middle" section of the file and finally, the record in Table3 as the footer record in the file. Here's an example showing the tables.


      MyHeader 12345                                         (the content of Table 1)

      I don't think my shrink understands me         (from Table 2)

      I don't think my dog understands me either   (from Table 2)

      It isn't that great to be a footer either!           (from Table 3)


Wanted (Dead or Alive) output file that  looks like this:


MyHeader 12345

I don't think my shrink understand me

I don't think my dog understands me either 

It isn't that g

search results showing label text


I have a custom page layout where I have site columns. My search results shows site column names as part of description. Actually it should show data within those site columns. To dig into this I looked into managed property "Description" which is mapped to following different crawled properties - 


I don't know what are those crawled properties. Can anyone help here?

Thanks in advance.


Full Text search join runs really slowly when inserting results into a table.


We have a problem when inserting the results of a join on a full-text search into a table. I have had to anomalyse the query but the bottom line is that the insert into a table is the factor that makes the query run really slow.

The join itself works fine and returns the result set (2 rows in this case) in approx 100 ms:

    tablea WITH (NOLOCK) 
INNER JOIN CONTAINSTABLE (indexedviewa,*,'nnnn') AS kwsearch
    ON kwsearch.[key] = dbo.tablea.aaaa 
WHERE p = 1
AND q = 2
AND r = 0
AND s NOT IN (8,9)
AND t = 'zzzzz'

However, when the results of the join (2 rows in this case) are taken and inserted into a table (whether it be #temp or a permanent table), the query takes approx. 3500 ms:

    propertyId  int,
    agentId     int);

    tablea WITH (NOLOCK) 
INNER JOIN CONTAINSTABLE (indexedviewa,*,'nnnn') AS kwsearch
    ON kwsearch.[key] = dbo.tablea.aaaa
WHERE p = 1
AND q = 2
AND r = 0
AND s NOT IN (8,9)

SSIS text qualifier results in text file containing "_x003C_none_x003E"


There is a bug in SSIS when exporting data from SQL to a comma delimited text file where you specified no text qualifier.

This bug apparently only occurs when you develop the SSIS on a x64 win7 PC and copy the .dtsx file (windows explorer copy/paste) to network path of a x86 SQL server and schedule the job to run from SQL Agent on the same x86 SQL server.

When the SSIS runs, the text file is written out containing text qualifier = "“_x003C_none_x003E".

If you look at " _x003C_none_x003E", it actually means <none>.  x003C = "<" and x003E = ">".


If you go into the SSIS package, double-click in the connection manager section to open the flat file connection manager editor and try to clear the text qualifier removing the <none>, the <none> value get added back in.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

AutoCompleteStringCollection for text box in DataGridView 2.0

I have been searching for a way to have autocomplete in a DataGridTextBox
object. There does not appear to be an obvious way to do this like you would
for a TextBox outside of a grid using the AutoCompleteCustomSource. Any
thoughts on how I can add this collection? :)

Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

Built-in Functions - Text and Image Functions

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Temporary Tables - MS SQL Server

Usage of temporary tables in MS SQL Server is more developer friendly and they are widely used in development. Local temporary tables are visible only in current session while global temporary tables are visible across all sessions.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend