You are here: Re: Convert Access Query to SQL Server View « MsSQL Server « IT news, forums, messages
Re: Convert Access Query to SQL Server View

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация