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

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

selecting older data

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

i have a loadtime column in my table . I would like to select the account which are older than 15 months .

select count(*)  from tablename

where createddate =   (what function should i write to select older than 15 months data.)   


View Complete Post

More Related Resource Links

Error selecting "Business Data Connectivity" service application in MSS 2010 with WCF hotfix on W8R

I'm getting "BDC Metadata Store is Currently Unavailable" when navigating to the External Content Types object in SPD 2010. Hot fix is installed.  No errors in the eventlog? 

SQL 2000 migrating older data to a different database

I've a sql server 2000 database, and now its size has increased tremendously. it is roughly 20 GB. this db contains data since last 4 years i.e. 2007. so i would like to create a new db with same schema, move all the data for the year 2007-2008 from the existing database to this newly created db. and then continue to use the exisitng db with my application.  now in my application, there will be an option to switch db, if i select the newly created db, it will fetch the data for year 2007-2008. if i select the existing db, it will be working with the current data.   please suggest what is the best approah to work on this. my application is a vb.net desktop application with framework 2.0. please suggest thanks shruti  

Problem getting same record when trying to populate data into texboxes when selecting a row/record f


I can't seem to get the select record from the datagrid to populate in the textboxes. I get the same record no matter what I select in the datagrid. Hopefully someone can help with this. I tried using a where clause for POPULATION_LIST_ID = '" & Me.lblPopulationID.Text & "' and I get a ORA-01722 error - invalid number. Here is the code I have so far for the grid:

  Protected Sub MHGrid_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MHGrid.SelectedIndexChanged
Me.Table1.Visible = True
Me.MHGrid.Visible = True

Dim dvSql As DataView = DirectCast(MHFoundation.Select(DataSourceSelectArguments.Empty), DataView)

For Each drvSql As DataRowView In dvSql
Me.lblPopulationID.Text = drvSql("POPULATION_LIST_ID").ToString
Me.txtMRN.Text = drvSql("MRN1").ToString()

Help selecting data from view?



I have:

SELECT * FROM [bloxview] WHERE (([User Id] = @User_Id) AND ([permissions] = @permissions)

@User_Id is an url querystring (?id=), and @permissions is the value '1'

But i also want to add to this select:

OR (regarding to the permissions)

WHERE [permission] = a number which matches the 'permissions' called Expr3 on the view) column value of a different table, but only rows where this tables 'userid' column = the urlquerystring id and the 'theiruserid' column matches the Profile.UserName signed in..

Am i best off using a view for this? or can i access and compare two tables at once?

Can someone help me put the above into proper code?


Selecting Data from the database



how can I read data from my database.

I'm have a little experience with SQL Statements.

But if if enter the following SQL Statement then I get error messages and no data.


Here a short example for a inquiry from my database "Phone"

Select firstname, name, city, aeracode and number FROM phone WHERE name LIKE 'Meier%' AND city LIKE 'Oxford%'

That is the correct syntax in db2.

How should I enter that here with the SQL Server?





Selecting data from multiple tables whilst using a union statement.



any help on this would be great.

I basically have a series of tables from one database that have an identical structure thus making retrieval of all records fairly easy (I just use a UNION ALL statement). However I need a list of values from another table within a different  database that contains information regarding the group of the data.

I so far have the following:

SELECT Table1.* FROM Table1 UNION ALL SELECT Table2.* FROM Table2 UNION ALL SELECT Table3.* FROM Table3 UNION SELECT Database.dbo.SRFILE.SR_GROUP FROM Database.dbo.SRFILE INNER JOIN Database.dbo.SRFILE.SRONUMBER = Table1.Incidentx

I keep receiving a unable to parse message however all I need to retreive is the SR_GROUP value but just don't know the correct syntax. Is it actually possible to do this as the structure of SRFILE is not the same as Table1/2/3.

Thanks again,


Selecting a Task List in Sharepoint Designer 2007 while setting up "Collect Data from User"

When using Sharepoint Designer 2007 to Collect Data from User the task list cannot be selected.  Instead the Task list that is defaulted is the most recently created Task List.  How can I select a specific Task list to associate with"Collect Data from User"?

Using infopath and SharePoint together for selecting a single attribute and having the other data au



Version: Infopath 2007

I have a process that is currently handled in SharePoint with the following data (employee ID ((4 digit ID)), employee name, employee contact, employee start date etc.) in multiple columns.  I would like to create a new employee form that will autofill the information from my SharePoint site into the fields I want populated.  So if I choose employee ID 1234 I would like the employee name, employee contact, and so forth to fill in the appropriate box on my form.  The data is already populated in my SharePoint site but I am just having a hard time getting this to work.  Infopath recognizes my SharePoint site but I cannot get the autofill function to work. 

Also on this form I would like to include other functionality. I only have 4 employee types (A, B, C, D) but when a employee starts with the company we have a list of multiple choice questions that have check boxes under each question but you can only choose one.  So I would like to have a sheet that if I select employee type A all the questions that are not related be either grayed out or disappear and have the form only show the items that are appropriate for the employee type. 

If anyone is willing to send a sample of what I am looking for that would be great!  I only need one example to go off of.


Issue in selecting data from SQL Server 2008



I have a table in my SQL Server. I have copied all the data from an excel to table. When I am querying the data like this..

SELECT [App_Name],[Link],[Comments] FROM [App_Links] where Env_Ref_ID=1

and App_Name = 'O2' 

I am not getting the result. But I have O2 in my table when queries as

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

Editing the Data in a GridView

In addition to deleting a GridView's underlying data, another common need is to allow end users to edit the data displayed in a GridView. With ASP.NET 1.x's DataGrid control, editing the data is certainly possible, but requires creating three event handlers and writing a dozen or so lines of code. With the GridView and ASP.NET 2.0, it is possible to create an editable GridView without writing a single line of code! All of the necessary functionality is encapsulated within the GridView.

The GridView allows editing on a row-by-row basis. An editable GridView contains an additional column with an Edit button in each row. When the end user clicks on an Edit button that row becomes editable, causing the Edit button to change to Update and Cancel buttons and the other columns to become TextBoxes. The end user can then update one or more column values and click Update to save their changes.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Dynamic Data Templates in GridView ASP.NET 3.5

At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.

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.

Displaying Data using ASP.NET 2.0 Repeater and C#

This tutorial will show you how to display data using the .NET Repeater Control, ASP.NET 2.0 and C#.NET

The Repeater control is a powerful tool and is easy to use.

First, you will need to import the System.Data.SqlClient namespace.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.
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