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

Post New Web Links

select 15 words(not character) from table

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net

i want to select only 15 words from table  , plz reply me how can i do this???

View Complete Post

More Related Resource Links

want to autoincrement a character type in table

For Example, "E0001" Everytime  it will automatically incremened by 1. "E0001" -> "E0002-> "E0003" and so on. "E0010" -> "E0011" and so on. "E0100" -> "E0101" and so on.  

SELECT statement to return NULL by matching data from another table.

Hi,I am fairly new at SQL and I have been struggling for days now trying to find an answer to my problem and i have come to the point where i have run out of ideas and about to give up. I'm hoping someone can put me in the correct path. The problem I have 3 table Table 1 Department" has the following columns: REF, NAME Table 2  "Department_Collection" has the following columns: REF, DEPARTMENT_REF, MANAGER_REF, STORE_REF, ACTIVE Table 3 Store" has the following columns: REF, NAME, STORE_ID  What i am trying to do is to take all the rows in the Department table and get a matching row (DEPARTMENT.NAME, DEPARTMENT_COLLECTION.REF) from the Department_Collection table, if it does not match any then still display DEPARTMENT.NAME but mark DEPARTMENT_COLLECTION.REF as null. I have tried the following select statement but it seem to remove all null values when supplied with a 'storename' SELECT DEPARTMENT.NAME, DEPARTMENT_COLLECTION.REF FROM DEPARTMENT_COLLECTION right outer join DEPARTMENT on DEPARTMENT_COLLECTION.DEPARTMENT_REF = DEPARTMENT.REF left outer join STORE on DEPARTMENT_COLLECTION.STORE_REF = STORE.REF where STORE.NAME = 'storename' order by DEPARTMENT.NAME   Any help will be greatly appreciated. Thanks

select max record to join another table sybase

select a.pono,(select (user) from user where userid=a.userid having date=max(date)) as user from a inner join b on a.no=b.no  in the result , i have selected the same id and retrieve two records every thing are same except the date how can i select the record out of two record which date is max date as the where Clasuse to select correct user poid    date                name 1        12/08/2010      Mary 1        20/08/2010      Peter   now i would like to select name which id=1 and date is max and then use the name to join another table because name is foreign key  

can alias in select be used for selecting other column in that table?

Hi All,I want to use an alias name in a select clause to select other column in that table? select   top 1 (   case when CreatedByName <> '' then 'yy'         else 'xx' end) as filName, (filName + 'xx')from Order       But it throws error like " Invalid column name 'fileName'."Could you please help me out?

Tricky SELECT query from a Single Table

Hi I have a 2 rows of data in a table as mentioned below   Table1             ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 NULL 40 NULL 20 4 9 2010 400 NULL 200 NULL  I need a SELECT query to get the output in a single row as ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 400 40 200 20 Could anybody help me in writing a query for this? 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 to select bottom record if there is no id in table.

Hi All, I am trying to select the bottom record but there is no id in table. For Example A              B jo             john so             som mo            mon to              tom go              gone

Delete objects from table using another table to select rows - help needed

I have one table named 'dbo.ac_Products'Within this table there is a column named 'ProductId'There is also another table named 'dbo.ac_CatalogNodes'Within this table there is a column named 'CatalogNodeId'and a column named 'CatalogNodeType'I need to delete all the rows from 'dbo.ac_Products' and 'dbo.ac_CatalogNodes' where 'ProductId' = 'CatalogNodeId' and 'CatalogNodeType' = 1Any help would be greatly appreciated!

select only 3 digits from the database table column ?

hi all i want to select data from database like that i have a column name ID , i want to select only first three digits from that column ? how can i do it ?

Avoiding a SELECT distinct query generated by SSAS when using dimension derived from fact table

Hi, I am using a dimension derived out ot a fact table and the factt able primary key is dimension key. Issue is, there are large number of rows and so many attributes. SSAS issues distinct query and it takes large amount of time. Without the distinct statement, query takes only 3 min for 4 million rows. With the distinct, it takes 20 min. Becuase the fact primary key is the dimension key there is no need of a distinct statement. I know there is a option in the dimension to say "By Table" to avoid this. But unfortuantely, i breach the 4 GB limit for strings. Any suggestions for optimization? Thanks,  Sambath

generate AccNo in SQL(select min AccNo from table where AccNo>300000000

hi all..., i create a registration form and it'll generate AccounNo for user after they click "SAVE" button. my database AccountNo start from 300000000 it's generate ID after >300000000 if i register a person it will register to 300000001 let's say i have AccountNo- 300000001 300000002 300000004 300000005 i dun have "300000003" i want to get that Account No to my registration... when i click "SAVE" it's have to search the minimum Account No from database and add user... how to do this..can anyone modify this code to read min AccountNo from database.. here's the code that i have using : try { connection.Open(); #region Generating a newAccNo SqlCommand newAccNoCommand = connection.CreateCommand(); newAccNoCommand.CommandText = "SELECT TOP 1 AccNo FROM Debtor ORDER BY AccNo DESC"; newAccNoCommand.CommandType = CommandType.Text; int minCurrentAccNo = 0; try { if (!int.TryParse(newAccNoCommand.ExecuteScalar().ToS tring(), out minCurrentAccNo)) { minCurrentAccNo = defaultAccNo; } } catch { minCurrentAccNo = defaultAccNo; } int newAccNo = minCurrentAccNo + 1; newAccNoCommand.Dispose(); #endregion

Create store Procedure for select Table by Passing Table Name In Parametere

I want to create a Procudure to Select all Information in Table Like (select * from TableName) but Condition is I do not want to Mention The Fix Table Name I will send the Table Name In a parameter from My Vb.net Project like This (select * from @Parameter ) and Then The Select Procudure work with on That Table. It will be change depend on my vb.net reqierment I already Created a Procudure But it Does not working. It is in below. alter proc AllSelect (@Table varchar (30)) as DECLARE @sql nvarchar(MAX) SET @sql = ' Select * from '+@Table+' ' If possible Please let me know also Update and Delete proc by same way. with Regards Suman Bangladesh

select data from table where it contain (.) ???


hi all

i have Price column in my table ( tbl1)

1.2           1.44         1              1.66

how can i select the prices that dont contain (.) ??

and then update it to add (.0) to it ???

this mean i will find (1) then convert it to ( 1.0)

please help me ;)

Its posible to do a select without the table and the column names into a stored procedure?



I need your help. Imagine that I have two tables:

  1. ALUMN wich has three columns: IdAlumn, Name and Address.
  2. SPORT wich has columns: IdSport, Name, Players and Description.

Supose that my tables could be differnced by a number 1 is for ALUMN and 2 is for SPORT.

And the columns of each table too. So 1 is for IdAlumn, 2 is for Name and 3 is for Address. 1 is for IdSport, 2 is for Name 3 is for Players and 4 is for Description.

For example the combination of table 2 and column 3 is SPORT-Players.

Then I want to do an stored procedure that receives two parameters (the table, the column) @tab and&

How can I select Table by pussing parameter table name


How can I Create Select store proc for select Table but I will send the Table Name in Parmeter which table I want Like below.



Proc SelectAll







select top row for multiple entry for a date in table


My current query is

select  Date= createdon , Total=count(*) from ReportDetail where 
reportid = 9 and (CreatedOn BETWEEN '07/01/2010' AND '09/30/2010') 
group by  createdon
order by createdon desc

return data like

2010-09-21 09:36:46.493    112
2010-09-21 08:33:12.667    114
2010-09-21 07:45:20.830    176
2010-09-21 07:33:34.340    114
2010-09-20 07:27:43.753    125
2010-09-17 10:04:27.120    75
2010-09-16 11:50:05.777    52

What I am looking for

2010-09-21 09:36:46.493    112
2010-09-17 10:04:27.120    75
2010-09-16 11:50:05.777    52

Basically for 9/21, I want to get only one latest row. Please advice.

Conditional insert: If select return rows, insert rows to table otherwise insert specific row indica

This is what I have

Insert into ReportDetail( Partcipantid, Reportid)  

select distinct ParticipantID , 9 from OpenCredit

      except select ParticipantID, 9 from StoreCredit where Closed = 0

 Issue is that when above select statement returns no row, it seems like no record is

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