473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Retrieving the contents of Cell based on values

I want to return the contents of a cell, similar to array(x,y) from a select statement, and have tried the following:

Expand|Select|Wrap|Line Numbers
  1. SELECT     TOP 100 PERCENT dbo.ReturnDoorPrice(dbo.[Quote Units].DoorStyle, dbo.[Quote Units].UnitNo) AS Door, dbo.UnitsCost.CODE, 
  2.                       dbo.UnitsCost.DESCRIPTION
  3. FROM         dbo.[Quote Units] INNER JOIN ... etc
where i have created a procedure and function
Expand|Select|Wrap|Line Numbers
  1. Create Procedure [dbo].[ReturnDoorPrice](@Doorstyle int,@unit int)
  2. as
  3. begin
  4. declare @lvreturn as nvarchar(75);
  5. EXEC @lvreturn = dbo.ReturnDoorPriceString @Doorstyle,@Unit;
  6. print @lvreturn;
  7. exec sp_executesql @lvreturn;
  8. end 
  9.  
  10.  
  11. Create Function [dbo].[ReturnDoorPriceString](@Door int,@unit int)  
  12. returns nvarchar(75) as 
  13. BEGIN 
  14. declare @lvstring as nvarchar(75);
  15.  
  16. set @lvstring = 'select top 1 ['+cast (@door as nvarchar(3))+'] FROM dbo.[Door Price] WHERE (ID = ' + cast (@unit as nvarchar(10)) +')'
  17.  
  18. return @lvstring
  19. END
I can get the string OK
i then can get the valve ok by execute sample
EXEC dbo.ReturnDoorPrice 2,1780;

returns value 81.675


But used with select causes error

how can i?
- Use procedure within select statement
or
- fix function to return value, not string

any help appreciated
Sep 10 '07 #1
0 775

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: anon | last post by:
I have a datatable of values and I am trying to obtain the values of a range of the columns. Imagine I have a table defined with columns headed "A" through to "Z" Now I decide that I want to...
2
by: Chris Bellini | last post by:
Greetings! I'm developing a C# application that needs to read some data from a selected XLS file. I've used VB in the past to automate Excel but this is the first time I've used C#. Back in VB,...
0
by: Ken Varn | last post by:
I am sure this has been asked before, but I was wondering is there some way of getting the data values out of a DataGrid Item without having to resort to indexing into the item's cell collection? ...
2
by: Iain | last post by:
Hi All Using Delphi 2006 developer - C# Project I have the following 2 event handlers for the datagrid - see botton of page Both events will fire off correctly but i have a problem collecting...
6
by: eureka | last post by:
Hi friends, I am developing a web application using Jsp and JS. I have a main Jsp page(Jsp1).Inside it I have an iframe having an Html- table which is created dynamically and contains all...
1
by: eureka | last post by:
Hi folks, I am working on a webapplication using Jsp and JS. On my main Jsp(Jsp1) I have a table which is created dynamically inside a <divand contains all the backend-table's records as rows,...
0
by: S_K | last post by:
Hi, I have an editible GridView that I can read the contents of each cell of the edit row as follows: int iEditIndex = GridView2.EditIndex; string strName = GridView2.Rows.Cells.Text; This...
1
by: adarshyam | last post by:
Hi, I am trying to import contents of excel spread sheet to the panel of textboxes (NOT datagrid). can anybody please tel me how to import the contents of each cell in the column into the textboxes...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.