Click here to Skip to main content
15,891,136 members
Home / Discussions / Database
   

Database

 
GeneralSELECT MIN Pin
Jaydeanster18-Apr-05 9:05
Jaydeanster18-Apr-05 9:05 
GeneralRe: SELECT MIN Pin
Colin Angus Mackay18-Apr-05 10:19
Colin Angus Mackay18-Apr-05 10:19 
Generalrdl query Pin
tvprithiv18-Apr-05 1:48
tvprithiv18-Apr-05 1:48 
GeneralRe: rdl query Pin
NewSilence23-Apr-05 13:22
NewSilence23-Apr-05 13:22 
GeneralSELECT with TOP question Pin
matthias s.18-Apr-05 1:14
matthias s.18-Apr-05 1:14 
GeneralRe: SELECT with TOP question Pin
WoutL18-Apr-05 1:32
WoutL18-Apr-05 1:32 
GeneralThank you, Colin and Wout! Pin
matthias s.18-Apr-05 1:46
matthias s.18-Apr-05 1:46 
GeneralRe: SELECT with TOP question Pin
Colin Angus Mackay18-Apr-05 1:33
Colin Angus Mackay18-Apr-05 1:33 
matthias s. wrote:
SELECT TOP @TopLimit NewsText, LanguageID FROM vl_News

This is not permitted in SQL Server 2000, (it is available in SQL Server 2005).

Your Stored Procedure will need to build some dynamic SQL and execute it.

e.g.
EXEC('SELECT TOP '+CAST(@TopLimit AS VARCHAR(10))+' NewsText, LanguageID FROM vl_News');


Using Dynamic SQL like this has some security implications. For example, at the boundary of the EXEC the security is re-evaluated. Normally, you can grant execute permission to a stored procedure but not need to grant select/update/insert/delete permission to the tables the stored procedure uses because the security is evaluated when you start the stored procedure and it is not re-evaluated for each of the tables within it. With dynamic SQL execution the security is re-evaluated so you must have SELECT permission on the table in the EXEC statement.


My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More


GeneralRe: SELECT with TOP question [addendum] Pin
Colin Angus Mackay18-Apr-05 1:35
Colin Angus Mackay18-Apr-05 1:35 
QuestionCreating an IStream object in OLE DB? Pin
mjharvey17-Apr-05 16:22
mjharvey17-Apr-05 16:22 
AnswerRe: Creating an IStream object in OLE DB? Pin
Mike Dimmick18-Apr-05 1:04
Mike Dimmick18-Apr-05 1:04 
GeneralRe: Creating an IStream object in OLE DB? Pin
mjharvey18-Apr-05 13:15
mjharvey18-Apr-05 13:15 
GeneralRe: Creating an IStream object in OLE DB? Pin
mjharvey18-Apr-05 17:05
mjharvey18-Apr-05 17:05 
GeneralProblem with sql query in vb.net Pin
gundamhamtaro16-Apr-05 15:18
gundamhamtaro16-Apr-05 15:18 
GeneralRe: Problem with sql query in vb.net Pin
Colin Angus Mackay16-Apr-05 23:55
Colin Angus Mackay16-Apr-05 23:55 
GeneralRe: Problem with sql query in vb.net Pin
gundamhamtaro17-Apr-05 1:56
gundamhamtaro17-Apr-05 1:56 
GeneralRe: Problem with sql query in vb.net Pin
Colin Angus Mackay17-Apr-05 2:04
Colin Angus Mackay17-Apr-05 2:04 
GeneralRe: Problem with sql query in vb.net Pin
gundamhamtaro18-Apr-05 0:05
gundamhamtaro18-Apr-05 0:05 
GeneralRe: Problem with sql query in vb.net Pin
Colin Angus Mackay18-Apr-05 1:26
Colin Angus Mackay18-Apr-05 1:26 
GeneralRe: Problem with sql query in vb.net Pin
gundamhamtaro18-Apr-05 20:22
gundamhamtaro18-Apr-05 20:22 
GeneralRe: Problem with sql query in vb.net Pin
Colin Angus Mackay18-Apr-05 22:45
Colin Angus Mackay18-Apr-05 22:45 
GeneralFiltering on a variable in SQL Pin
Stuck!16-Apr-05 1:37
sussStuck!16-Apr-05 1:37 
GeneralRe: Filtering on a variable in SQL Pin
Colin Angus Mackay16-Apr-05 6:20
Colin Angus Mackay16-Apr-05 6:20 
GeneralRe: Filtering on a variable in SQL Pin
Stuck !16-Apr-05 22:09
sussStuck !16-Apr-05 22:09 
GeneralRe: Filtering on a variable in SQL Pin
Colin Angus Mackay16-Apr-05 23:44
Colin Angus Mackay16-Apr-05 23:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.