Dyanamic Sql
Apr 1, 2004
Hi I was building a dynamic sql with output please tell me where I am wrong.
Or Tell me right way to do it
My table name is variable (Stock name)
I want close price for given Stock
CREATE PROCEDURE SP_GET_CLOSE
@TableName as varchar(50),
@close_price as varchar(50) output
AS
Declare @SQL NVarChar(1000)
Declare @high varchar(50)
SET @SQL = 'Select top 1 @close_price = [close] from '+ @TableName+ ' order by trade_date desc'
print @SQL
Exec sp_executesql @SQL, N'@close_price varchar(50) output' , @close_price
GO
View 3 Replies
Oct 19, 2005
Hi all,I'm building a search function and I need do it using stored procedures. I'm searching a table on 'Name' 'email address' and 'key words'. (basically 3 columns). The user must be able to use it as SELECT ............ WHERE (NAME LIKE @name) AND/OR (Email LIKE @email) AND/OR ............. Can some one tell me how to handle this in a stored procedure. By the way is this approch correct. Please tell me if there is a better method to tackle this situation.Thanks,-VJ
View 4 Replies
View Related
Nov 12, 2000
Hello,
Can anyone tell me what the impact of dynamic database backups in sql 6.06.5
will have on users using the database?
Will their user processes be blocked?
Will their queries run slower than normal (how slower)?
Will there be a lot of locking activity as the SQl tries to backup?
Will the serverdatabase run slower
Anything else I may be missing?
Regards,
Hitesh
View 3 Replies
View Related