|
you're saying that if a user connects to your DB via the SQL Server tools, they have access to stuff that the role they log in under should not see ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Correct...
It seems as if any user that can log in to SQL, can use SQL Server to see the list of table, list of SP and import/export data even though their user role does not allow SELECT, UPDATE, INSERT or EXECUTE.
|
|
|
|
|
Hi,
In a table with a primary key and a foreign key like this.
I-------I-------I-------I
I pkey I fkey I name I
I-------I-------I-------I
I 1 I 1 I ITEM I
I-------I-------I-------I
I 2 I 1 I ITEM2 I
I-------i-------I-------I
If we were to run a select query against this table that returns just one row. Would be any performance benefit if we have this select ?:
SELECT * FROM The_Table WHERE pkey=2 AND fkey=1
over when we have this select ?:
SELECT * FROM The_Table WHERE pkey=2
|
|
|
|
|
As the primary key is unique (a condition of being a primary key is that it uniquely identifies the row) then I wouldn't see any need for any additional information in the WHERE clause.
Whether it has any benefit or not depends on how you set up the table. If you go with the traditional defaults then I don't see it having any additional benefit. But I doubt it would have any negative effect either.
|
|
|
|
|
If we define an index on the foreign key field , will be any performance gain ?
|
|
|
|
|
devboycpp wrote: If we define an index on the foreign key field , will be any performance gain ?
In this case, I doubt it. The WHERE clause already contains a reference to a column that is guaranteed to be unique (i.e. the Primary Key) and is most likely to be indexed (unless it was removed) so will go directly to that row. Foreign keys are not normally unique.
Also, adding an index can make performance worse for INSERT, UPDATE and DELETE operations.
|
|
|
|
|
select empid,empname,valid bit null
into #temp
from table
I know this is wrong. What I need is to add a new column which is not in table [valid] and assign that column as bit type and value as null.
Can you please help?
Thanks
|
|
|
|
|
A BIT column is not nullable.
Paul Marfleet
|
|
|
|
|
Please help me this problem, thanks.
Thao
|
|
|
|
|
I'm sorry, I'm sure English is not your first language, and I don't want you to think you're under attack for that. But, your question makes no sense. Your english doesn't have to be perfect, we're very forgiving, but if we don't understand, we just can't hope to help.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I was able to run ssis Installation successfully. In summary of last step, is it possible to take out the author and log file information or rewrite them with other information?
|
|
|
|
|
hi all,
i want to write a generic Insert & update procedure.It should work with different tables having diffrerent datatypes.suppose let say table1 may have col1 int,col2 varchar... and let say table2 may have col1 varchar,col2 char..like that..and so on..
generally till now wat iam doing is that iam writting different stored procedure for different tables..
Now i want to write One Insert & update procedure in my project...and for all the tables in the project i want to use only that procedure.
Is it Possible? If yes kindly help me ..on resolving this issue..
Thanks & regards
suman
|
|
|
|
|
You can. But it would most likely end up using dynamic SQL and you might as well just fire that against the database instead.
|
|
|
|
|
hi
thanks for u reply..
can u help me in writing the query for that requirement.If u have any thing about the dynamic sql and like generic procedures ..please help me by giving some sample query.
|
|
|
|
|
What's the difference between @a and @@a type parameters
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
You pass in parameters that have @. @@ relates to internal functions and values inside SQL Server.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
@a is a user defined parameter where as @@<param-name> such as @@Identity is a system defined parameter.
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
hi
@ stands for local variable
@@ Stands for System variables
eg:
declare @name as nvarchar
set @name='hello'
print @name
select @@VERSION
Returns the date, version, and processor type for the current installation of Microsoft® SQL Server
|
|
|
|
|
how can i use the for loop in stored procedure
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Sonia Gupta wrote: how can i use the for loop in stored procedure
You can't. Use a WHILE loop instead.
|
|
|
|
|
ok thanks
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
how can i use the while loop.example have to to use select statement
for loop=1 to select count(*) from table
next
this is merely an example.i lknow u have have told i can't use the for loop.this is just to make u understand.
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
declare @cnt as int
set @cnt = (select count(*) from table)
while .....
Regards
KP
|
|
|
|
|
You may have to use a cursor.
This depends on what you are doing in the loop.
A cursor will let you process each row of a query individually.
If you google "SQL cursor" you will find lots of examples.
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
GuyThiebaut wrote: You may have to use a cursor.
Don't encourage people to use a cursor unless there is absolutely no other choice. Cursors are extremely slow in SQL Server and should be avoided unless absolutely necessary.
|
|
|
|