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

Post New Web Links

Field Population Count over whole table

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :Sql Server


I have a huge table and would like to know of a way to count field population across the whole table, this can be stored in a separate table to refer back to, i am using sql 2008. A visual display could be:

TableName FieldName Blank Populated MinValue MaxValue DateCreated

Person       Address1    1500  5000        <blank>    9 any street   30-sep-2010

Person      First Name    6000  500          <blank>     Zac               30-sep-2010

has anyone done something like this before, would like something quite reusable and generic?

any help greatly appreciated.

View Complete Post

More Related Resource Links

Get the count of the recently added records to a table

i need to create 2 temporary tables. The records inserted into the 2nd table is the same as that from table1. Now, i am inserting some other records into table 2.what i need is, to retrieve the count of the recently added records into table2.How to achieve this? 

Count numbers of days (no time table in datasource)

I read the following regarding adding a measure for counting the number of days: The trick is to create new measure group, which will have only one dimension - Time, and a measure with Aggregation Type 'Count' bound to the Day attribute of Time dimension (or any other attribute if we need to count something different from days). The most important setting on this new measure group is to leave IgnoreUnrelatedDimensions=true - this will allow to use this measure across any other dimension in the cube. Howerver, this solution assumes that one has a time dimension based on a table in the datasource. I have a Time dimension that created was by the BIDS wizard that is not in my source database but appearantly invisibly hidden on the AS server without direct access to it. (If I try to add a new measure group (as needed according to the post above) then I can only choose from tables that have nothing to do with time). Can somebody explain how I can do this without a specific timetable in my datasource? Do I need to add a timetable just for this purpose? Can it be stand-alone or do I need to add a relationship with all current tables that have date-columns in them? (I am a finance manager that is building a sales cube based on Navision 3.6, which is already working quite nicely, but still very much a newby)

importing table with Access "memo" field to SQL

I imported an access database using the DTS wizard, into SQL 2005. There is a field in one of the Access tables that is a memo field, filled with a bunch of text including linebreaks. After importing, the field is indicated as the nvarchar(MAX) datatype when I check in SQL Enterprise Manager. The text in that field is displayed without line breaks, both in EM and when viewed on a web page. I changed the datatype of that column to "text" and now can see line breaks when I hover over a value in that column while viewing the table data in Visual Studio 2010's Server Explorer.But when I display the data in a ListView, there are no linebreaks. When I view my TableAdapter in my dataset, there are no linebreaks either.I must be missing something here? Thanks. 

SELECT COUNT(*) FROM [Table] from an Oracle database

Hi friends, I have problem when retrieving a result from SELECT COUNT(*) FROM [Table] from an Oracle database. When I try to put the result (single row) in a variable I get the following error message. [Execute SQL Task] Error: An error occurred while assigning a value to variable "RowsSource": "Unsupported data type on result set binding RowsSource.". Pls help me Mahe

How can I get the cumulative sum of a field in a table

For Eg.   I have a table like gias given below: Name                  Amount ------------------------------ aaa                       10 bbb                      20   and I want an output like one given below on running SQL query or stored procedure Name                  Amount                  cumulative amount --------------------------------------------------------------------- aaa                       10                              10 bbb                      20                              30   can anyone plz help me on this

xml as text will not save in table field in some cases

I have a stored procedure that saves 4 fields into a data table named xml.  One of the fields is called xml, and is just a text field.  Usually, my sp properly stores the data, but occassionally the xml portion of my record is not stored.  It's on a remote server, so I'm having trouble hooking up a debugger to it, but I may have identified some charactoristics of the data in the cases where the data is not saving into the field.  I think it has a lot of "......."s mixed in with the xml.  I'm wondering if SQL could be identifying this as some kind of security threat.  Any thoughts would be super appreciated. 

Count Value In XML Field Via XQuery

I have an XML field in SQL Server 2008. Within the XML is a node entitiled "Key".  There are some XML fields that will have the same value of 'Key'.  I want to count how many duplicates per 'Key'.  For example, if I query :  select   messagebody.query('/msg/body/Color/Key') from #t then the result might be: <Key>735110040</Key> <Key>0115220</Key> <Key>735110040</Key> I need to get the following output: 735110040, 2 0115220, 1 If I incorporate the traditional a count/group by with XML then I can't use group by as normal or I get "Cannot use an aggregate or a subquery in an expression used for the group by list of a GROUP BY clause." : select   messagebody.query('/msg/body/RetrieveAccount/Key'), count(('/msg/body/RetrieveAccount/Key'))from #t  group by count(('/msg/body/RetrieveAccount/Key'))  I've tried variations on the xquery count() function but I keep getting something wrong.  Does anyone know what the correct syntax for this scenario would be? Thanks, cj

Update duplicate field in same table

  hi I have a table with some other duplicate field as below   IssueID Title A1 Test1 A1 Test2 A2 Test3 A2 Test4 A3 Test5 A4 Test6   i want update all duplicate field based on IssueID and the final result will show as below   IssueID Title A1 Test1 A1 Test1 A2 Test3 A2 Test3 A3 Test5 A4 Test6 may someone help me?  

DataBase maximum table record count


Hello Friends,

My requirement is, we have more than 5 database servers, each server lot of databases, each database lot of tables.

 I want show the details


ServerName: abcServer

DatabaseName: xyzDatabase

MaximumRecordsTableName: empTable


In asp or Classic asp.

please anybody help for code and query.


how to split the connection string in asp ?

count of columns in a table?

how to know the count of columns in a table

Insert ID field into SQL table programatically from Stored Procedure



I have a table in SQL where I insert data (CatCodes) using C# code but I want to insert ID code (DealerID) with it as well. Following is my Stored Procedure and C# code:

PROCEDURE [dbo].[InfoInsert]
	-- Add the parameters for the stored procedure here
	@UserId uniqueidentifier,
	@Title char(32),
	@FirstName char(32),
	@LastName char(32),
	@CompanyName char(32),
	@Email char(32),
	@DealerID int OUTPUT

	INSERT INTO [tblDealers] ([UserId], [Title], [FirstName], [LastName], [CompanyName], Email) 
        VALUES (@UserId, @Title, @FirstName, @LastName, @CompanyName, @Email)
        select @DealerID = SCOPE_IDENTITY()



protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)

            //Insert membership and personal data
            TextBox UserNameTextBox = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");
            SqlDataSource DataSource = (SqlDataSource)CreateUserWizardStep1.ContentTemplateContainer.FindControl("InsertExtraInfo");



retrive details records as a field in master table


I have 2 tables:

Student table with Id, Name fields

Phone table with Id,StudentId,PhoneNumber

Now, I want to show student list with all it's phone numbers in 1 row.

this query: "select student.*, phone.* from student inner join phone on student.id=phone.studentid" shows me the list of students with duplicate per each phone number.

I want something like this:

1 paul       66665566,7766665

2 ben        5566556,8877667

3 sam       4444334,3454332,7656765

how to get Notepad all Item in sql server database table field



I have one asp.net application using Sql server as back end.. in sql server database i have one table which consist two fields.. ItemName and Rate

I have one notepad file which consist around 700 ItemName with Rate.. 

So how to get this ItemName and Rate in my Table...

stored procedure "need to take count from same table with different condition"

i have a stored procedure with few variable ,and in each variable i am taking count from same table based on different condition.and also i need to group by it on base of date(monthly wise
but if i declare thevariable and set value in it, then on dispalying these variable i get same value for all the months ..i am sending some part of it..please if possible make the changes and let me know where am i making mistake..







How to add a field data onto an email table?


Hi VB newbie here. How can I call my TextBox ID = "txtFromAddress" data to a table that I am trying to send? Right now it is just showing the text '& txtFromAddress' on the table on the email that I send. Thanks in advance.


<table><tr><td><b><font color = 336699>Contact Information</b></font></td><td></td></tr><tr><td>Contact Name</td><td> & txtFromAddress </td></tr></table>

Contact Information
Contact Name & txtFromAddress

How to count records placed different order in a table?


In a table i have two column

for eg

column1 column2

1              2

2              1

3              1

2              3

1              1

From front end i m passing parameters like(1,2)OR(2,1)

i want to get a count of the pattern like (1,2)OR(2,1) only so i will get count 2 for the abv table.

tell me a select query to get the count?

Drag and drop field from db into HTML table cell possible?



I'm used to Dreamweaver where this is possible. I find it hard to believe that I would need to use a 1 column gridView control.

Is there a way to drag one field from the db Explorer window onto my page and NOT get a grid view?

Or alternatively, I used to be able to put something like this in ASP classic (years ago!) <%= Eval("User") %>

Any help would be SO appreciated.


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