|
Is there a way grant the right to alter any existing table for the current database to a specific user?
Thanks.
|
|
|
|
|
You could use GRANT ALTER TO [username]. However, that grants alter permission to all objects within the database, including functions, stored procs and views. I tried using ALTER ANY TABLE, but it is not a valid command. So as far as I can tell you need to explicitly grant ALTER permissions for each table and you will need to do it every time you add a new table.
You could write a script which loops through sys.objects and grants ALTER permission on each user table. But other than that there doesn't seem to be a way to do it and you're still stuck adding permissions each time a table is created.
|
|
|
|
|
Mark J. Miller wrote: So as far as I can tell you need to explicitly grant ALTER permissions for each table and you will need to do it every time you add a new table.
I thought so, but I still had some hop left that I could avoid it.
Thanks for the explanation.
|
|
|
|
|
How do I get the second most expensive call from my database. Currently I am using a Max(amount) statement, but as it turns out the dump of data I was given was just that, a dump, and they have put the total of all calls in my data as well. Can anyone give me some script to select the max amount, but the second biggest amount?
Thanks
modified on Thursday, April 3, 2008 3:12 AM
|
|
|
|
|
|
Ok that's great ye, thanks, but how do I get it to NOT display the TOP 1 and only the Second one?
|
|
|
|
|
Try something like this:
declare @max int<br />
<br />
-- get the maximum value<br />
select @max = max(call) from table<br />
<br />
-- get the highest value below the maximum<br />
select top 1 * from table where call < @max order by call desc
Of course, if you have two calls which share the highest level, this returns the third.
Regards,
Rob Philpott.
|
|
|
|
|
yes thank you. I've done something similar. I selected the Top 2 and ordered them desc and then returned that value to another Top 1 sort and got the second highest. I do think yours is more effective though.
Thanks alot
|
|
|
|
|
hi all,
how to import data from excel to sql server 2005 either by using ado.net or asp.net 2.0 and c#
Ashok
|
|
|
|
|
Is Google[^] broken in India today? Or did it just not occur to you to use it?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
pmarfleet wrote: Is Google[^] broken in India today?
That's just class. Awarding you a 5 to bring the average up.
|
|
|
|
|
Hi, thanks for looking
I hace a case in my select statement (SoldOut), how could i fiilter rows depending on that field
I made it work by putting the case in my where
But how can i put the case in my select and apply use where to filter rows?
Thanks again
Alexei Rodriguez
|
|
|
|
|
|
hai
can any one plz tell me how to use urdu language in c# forms and through
form insert data into sql server when i i insert data in sqlserver it
show ???????? instead of actual data .this problem also caries with
crystal report 9
|
|
|
|
|
Use nvarchar[^] columns to store your data. This allows you to take advantage of the extended character set provided by Unicode encoding.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hello!
I am writing a stored procedure, and in my stored procedure, I need to work with a string.
I found some functions in SQL: DATALENGTH, and SUBSTRING. But I can't find information
about how to work with strings in SQL. What I need is to walk through a string, exemine
every character and make the string smaller depending on the characters.
First, how can I compare ntext strings?
And, second, maybe there are more string functions in SQL?
Thanks in advance!
Have a nice day!
|
|
|
|
|
|
You probably want to take a look at nvarchar and varchar types. You can also take a look at functions that might help you on msdn.
http://msdn2.microsoft.com/en-us/library/ms186939.aspx[^]">
|
|
|
|
|
My problem now is getting the last character of a ntext variable.
I do it this way, but it doesn't seem to work:
SUBSTRING(@strvar, DATALENGTH(@strvar), 0)
Have a nice day!
|
|
|
|
|
<br />
DECLARE @strvar VARCHAR(50)<br />
SET @strvar = 'hello world'<br />
<br />
SELECT SUBSTRING(@strvar, LEN(@strvar), 1)<br />
|
|
|
|
|
Alright, now I try to compare it to a '\' using LIKE, and it never works.
How can I check if this character is '\' or not?
Have a nice day!
|
|
|
|
|
DECLARE @strvar VARCHAR(50)
SET @strvar = 'hello world'
SELECT CASE SUBSTRING(@strvar, LEN(@strvar), 1) WHEN '/' THEN 1 ELSE 0 END
|
|
|
|
|
Why do I need the SELECT?
Won't
WHILE(SUBSTRING(@strvar, LEN(@strvar), 1) NOT LIKE '\')
work?
Have a nice day!
|
|
|
|
|
You don't need SELECT, I'm just using it like a Debug.Print to see the value returned. Why are you using LIKE? You aren't making any kind of pattern comparison. You are comparing the result with a constant expression. You should be doing it this way:
SUBSTRING(@strvar, LEN(@strvar), 1) <> '\'
|
|
|
|
|
Thank you!
Have a nice day!
|
|
|
|