YO! Yes you can use Exec to resolve this problem but when you create a Stored procedure all command are pre compiled when you execute it. The difference is when you built a SQL String and execute it with "EXEC" SQL Server need to compile this string.
Look in documentation : stored procedures / application performance Stored Procedures : The benefits of using stored procedures in SQL Server rather than Transact-SQL programs stored locally on client computers are: They allow modular programming. They allow faster execution. <------------- They can reduce network traffic. They can be used as a security mechanism. Sorry for my superb english ! Yanik Lupien -----Message d'origine----- De : Bernd VanSkiver [mailto:[EMAIL PROTECTED]] Envoy� : Wednesday, December 05, 2001 11:03 � : SQL Objet : Re: SQL Query Builder & Date function problem Selecting a field value is actually what I want to do. Can I use the EXEC to do a sub query in a function like that? What is wrong with using the EXEC ? Bernd VanSkiver [EMAIL PROTECTED] ColdFusion Developer ----- Original Message ----- From: "Yanik Lupien" <[EMAIL PROTECTED]> To: "SQL" <[EMAIL PROTECTED]> Sent: Wednesday, December 05, 2001 9:53 AM Subject: RE: SQL Query Builder & Date function problem > Hi! > > I only have a small question it is possible to select some field using a > variable instead of a specific name ? > > Some thing like this : > > DECLARE @FieldName VARCHAR(25) > DECLARE @ID INT > > SET @FieldName = 'FileName' > SET @ID = 10 > > SELECT @FieldName > FROM TABLENAME > WHERE ID = @ID > > I don't want to use some thing like the command "EXEC ('SQLQUERY')" ... > > Thank! > > Yanik Lupien > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
