I have an excercise:
SET @.UserID = @.@.ROWCOUNT
it is said that there is mistake, nad to complete it there i no need of knowledge mssql? So where is mistake?@.@.ROWCOUNT is system variable that returns the number of rows affected by the last sql statement. It is usually used to verify the results of inserts and updates.
So I do not see how this would return a userid.
If you want to learn more, I would start here...
http://www.microsoft.com/downloads/details.aspx?FamilyId=A6F79CB1-A420-445F-8A4B-BD77A7DA194B&displaylang=en|||@.@.ROWCOUNT is system variable that returns the number of rows affected by the last sql statement. It is usually used to verify the results of inserts and updates.
So I do not see how this would return a userid.
If you want to learn more, I would start here...
http://www.microsoft.com/downloads/details.aspx?FamilyId=A6F79CB1-A420-445F-8A4B-BD77A7DA194B&displaylang=en
I know... But how correct it?|||if you want the userid use
select system_user|||So it must be
Select userid
Set @.userid = @.@.rowcount? :||||should be
select @.userid = system_user|||I don't think that you have posted the clearest definition of your problem
Showing posts with label mistake. Show all posts
Showing posts with label mistake. Show all posts
Monday, February 20, 2012
MSSQL Mistake
I have piece of code- SET @.UserID = @.@.ROWCOUNT and it's said that there is m
istake, where it is?"juokaz" <juokaz.23brpu@.mail.codecomments.com> wrote in message
news:juokaz.23brpu@.mail.codecomments.com...
> I have piece of code- SET @.UserID = @.@.ROWCOUNT and it's said that there
> is mistake, where it is?
>
> --
> juokaz
> ---
> Posted via http://www.codecomments.com
> ---
This is valid SQL.
What's the error message?|||declare @.UserID uniqueidentifier
SET @.UserID = @.@.ROWCOUNT
SELECT @.UserID
this will throw an error yes, assuming your @.UserID is an int this
should work
What I do not understand is how userid and rowcount have anything in
common?
maybe you are looking for one of these 4?
select user_id(),suser_sid(),suser_sname(),user
_name()
http://sqlservercode.blogspot.com/|||I have only this piece of code and its said that there is mistake, it's exce
rcise, so i dont have full code.
so far.
HTH, Jens Suessmeyer.|||Just as one of the posters mentioned before - the only flaw is the assignmen
t
of an integer value to the variable of an incompatible data type
(uniqueidentifier).
Is that it? Then, change the declaration of UserID and use a compatible data
type (any numeric type or a character type).
ML
http://milambda.blogspot.com/|||Bad thing - it's excercie, i have only this piece of code, and in excercise
it is said that to complete you mustnt have mssql knowledge...
have been posted here,
provided you declare the @.UserID variable first. Here is proof:
DECLARE @.UserID int
SET @.UserID = @.@.ROWCOUNT
Execute above against SQL Server and you will see no errors.
But if you ask if there is a "mistake", we can't answer that. Is it a mistak
e to drink petrol? Well,
it is possible. And since we know about the semantics (we all know a bit abo
ut the human physiology)
we can say that it is probably it is a mistake. But you have provided us wit
h no semantics at all.
So all we can say that it is possible to execute the code with no errors. Yo
u have also been given
proof of it.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"juokaz" <juokaz.23fh1o@.mail.codecomments.com> wrote in message
news:juokaz.23fh1o@.mail.codecomments.com...
> No ideas?
> juokaz wrote:
>
> --
> juokaz
> ---
> Posted via http://www.codecomments.com
> ---
>|||maybe some one could tell then, what this code would actually do? whats
the result?
what troubles such code could cause?
thanks.
istake, where it is?"juokaz" <juokaz.23brpu@.mail.codecomments.com> wrote in message
news:juokaz.23brpu@.mail.codecomments.com...
> I have piece of code- SET @.UserID = @.@.ROWCOUNT and it's said that there
> is mistake, where it is?
>
> --
> juokaz
> ---
> Posted via http://www.codecomments.com
> ---
This is valid SQL.
What's the error message?|||declare @.UserID uniqueidentifier
SET @.UserID = @.@.ROWCOUNT
SELECT @.UserID
this will throw an error yes, assuming your @.UserID is an int this
should work
What I do not understand is how userid and rowcount have anything in
common?
maybe you are looking for one of these 4?
select user_id(),suser_sid(),suser_sname(),user
_name()
http://sqlservercode.blogspot.com/|||I have only this piece of code and its said that there is mistake, it's exce
rcise, so i dont have full code.
quote:|||Unless you provide more SQL code we can only say that this is valid SQL
Originally posted by SQL
declare @.UserID uniqueidentifier
SET @.UserID = @.@.ROWCOUNT
SELECT @.UserID
this will throw an error yes, assuming your @.UserID is an int this
should work
What I do not understand is how userid and rowcount have anything in
common?
maybe you are looking for one of these 4?
select user_id(),suser_sid(),suser_sname(),user
_name()
http://sqlservercode.blogspot.com/
so far.
HTH, Jens Suessmeyer.|||Just as one of the posters mentioned before - the only flaw is the assignmen
t
of an integer value to the variable of an incompatible data type
(uniqueidentifier).
Is that it? Then, change the declaration of UserID and use a compatible data
type (any numeric type or a character type).
ML
http://milambda.blogspot.com/|||Bad thing - it's excercie, i have only this piece of code, and in excercise
it is said that to complete you mustnt have mssql knowledge...
quote:|||No ideas?
Originally posted by ML
Just as one of the posters mentioned before - the only flaw is the assignmen
t
of an integer value to the variable of an incompatible data type
(uniqueidentifier).
Is that it? Then, change the declaration of UserID and use a compatible data
type (any numeric type or a character type).
ML
http://milambda.blogspot.com/
quote:|||Exactly what is it that you want from us? The code executes fine, as already
Originally posted by juokaz
Bad thing - it's excercie, i have only this piece of code, and in excercise it is said t
hat to complete you mustnt have mssql knowledge...
have been posted here,
provided you declare the @.UserID variable first. Here is proof:
DECLARE @.UserID int
SET @.UserID = @.@.ROWCOUNT
Execute above against SQL Server and you will see no errors.
But if you ask if there is a "mistake", we can't answer that. Is it a mistak
e to drink petrol? Well,
it is possible. And since we know about the semantics (we all know a bit abo
ut the human physiology)
we can say that it is probably it is a mistake. But you have provided us wit
h no semantics at all.
So all we can say that it is possible to execute the code with no errors. Yo
u have also been given
proof of it.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"juokaz" <juokaz.23fh1o@.mail.codecomments.com> wrote in message
news:juokaz.23fh1o@.mail.codecomments.com...
> No ideas?
> juokaz wrote:
>
> --
> juokaz
> ---
> Posted via http://www.codecomments.com
> ---
>|||maybe some one could tell then, what this code would actually do? whats
the result?
what troubles such code could cause?
thanks.
MSSQL Mistake
I have piece of query:
SET @.UserID = @.@.ROWCOUNT
And its incorrect, where is mistake?
I have only this piece because its excercise.
Sorry if bad subforum. :)
You won′t get any other resposnes here as in the public newsgroups, because that is valid SQL. If there is a problem in this row the @.@.ROWCOUNT can′t be converted to the type @.userId is based on, but that was already said in the groups. Try to get more information about the code and post this back.
HTH, Jens Suessmeyer.
|||I have only this and i can't get more... Maybe it's logical problem?
Subscribe to:
Posts (Atom)