|
Posted by Hugo Kornelis on 05/19/06 00:45
On 18 May 2006 12:59:23 -0700, s_wadhwa@berkeley.edu wrote:
>Hi,
>
>If anyone has done the conversion of parameterized query in Access to
>SQL Server. Please guide me how to solve this query and how to take
>input in SQL query from Access forms.
Hi Shalini,
I see that your parameters refer to forms. Keep in mind that SQL Server
is not aware of the forms in yoour front-end - a big difference from
Access, which is DB and front-end lumped together in one application.
One possible way to convert this to SQL Server would be to create a
stored procedure:
CREATE PROC GoodNameGoesHere
(@BuildingNumber varchar(255),
@ctlFloor varchar(255),
@DepartmentFilter varchar(255))
AS
SELECT Col1, Col2, Col3, ... -- Never use SELECT * in production code
FROM Rooms
WHERE BuildingNumber = @BuildingNumber
AND "Floor" LIKE @ctlFloor
AND DepartmentCode LIKE SUBSTRING(@DepartmentFilter, 1, 4)
ORDER BY BuildingNumber, RoomNumber;
BTW, using a char datatype for a column named "Number" is highly
suspicious to me...
--
Hugo Kornelis, SQL Server MVP
Navigation:
[Reply to this message]
|