Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

T-SQL - What is the output of the statement Expand / Collapse
Author
Message
Posted Tuesday, June 16, 2009 11:44 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, November 26, 2013 12:42 PM
Points: 398, Visits: 105
Comments posted to this topic are about the item T-SQL - What is the output of the statement
Post #736225
Posted Wednesday, June 17, 2009 5:24 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, November 20, 2014 7:31 AM
Points: 2,360, Visits: 576
It's 6th October already? What was I drinking last night?!


Post #736403
Posted Wednesday, June 17, 2009 5:33 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 3, 2012 8:35 AM
Points: 1,608, Visits: 198
I ran the following:
create table tb_user
(name varchar(30));

insert into tb_user
values ('Assis Marques new');

UPDATE a
SET Name = 'Assis Marques new'
OUTPUT Inserted.Name, Deleted.Name
FROM tb_User a
WHERE Name = 'Assis Marques';

select * from tb_user;

The result is:
Assis Marques new

Since the where clause is false nothing is updated, there for Output is also null.


Raymond Laubert
Exceptional DBA of 2009 Finalist
MCT, MCDBA, MCITP:SQL 2005 Admin,
MCSE, OCP:10g
Post #736409
Posted Wednesday, June 17, 2009 6:33 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, September 24, 2012 8:10 AM
Points: 2,042, Visits: 499
Your initial insert statement is incorrect.

"Assume you have a SQLServer2005 database and that the table "tb_User" contains the user 'Assis Marques'"

You need to modify the initial insert to be this statement:

INSERT INTO tb_User(Name)
VALUES('Assis Marques');

Cheers,
Brian
Post #736466
Posted Wednesday, June 17, 2009 6:47 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 1:42 AM
Points: 20,799, Visits: 32,717
You know what they say, read the whole question.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #736482
Posted Wednesday, June 17, 2009 7:03 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Thursday, November 20, 2014 7:53 PM
Points: 9,928, Visits: 11,194
Hmm. I got my point, but two *columns* ???

Two rows would have been better perhaps?

Or even two lots of one row?

Oh well.




Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #736503
Posted Wednesday, June 17, 2009 7:34 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Monday, November 10, 2014 12:05 PM
Points: 3,969, Visits: 3,648
Interesting, I didn't know you could do that.
Post #736539
Posted Wednesday, June 17, 2009 7:35 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 3, 2012 8:35 AM
Points: 1,608, Visits: 198
Just goes to show that your mind sees what it wants to see. I read this three times before posting just to make sure I wasn't missing something. I still missed it.

Thanks for catching it and letting me know.



Raymond Laubert
Exceptional DBA of 2009 Finalist
MCT, MCDBA, MCITP:SQL 2005 Admin,
MCSE, OCP:10g
Post #736540
Posted Wednesday, June 17, 2009 7:37 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, May 13, 2014 2:31 PM
Points: 76, Visits: 152
Oh great - even in future, I got the question wrong - great motivation!!!

Farhan F. Sabzaali
PMP, MCP, MCDBA, MCSA, MCSE
Post #736546
Posted Wednesday, June 17, 2009 7:39 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Monday, November 10, 2014 12:05 PM
Points: 3,969, Visits: 3,648
Ray Laubert (6/17/2009)
Just goes to show that your mind sees what it wants to see. I read this three times before posting just to make sure I wasn't missing something. I still missed it.

Thanks for catching it and letting me know.



That's why they don't let us test our own code.
Post #736548
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse