| Author |
Topic  |
|
|
prasaditc55
Starting Member
8 Posts |
Posted - 07/27/2012 : 02:59:37
|
Hi,
wat is magic query in sql with example |
|
|
khtan
In (Som, Ni, Yak)
Singapore
16769 Posts |
Posted - 07/27/2012 : 03:11:36
|
No idea. Never heard of that.
KH Time is always against us
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48012 Posts |
Posted - 07/27/2012 : 03:17:11
|
where did you hear about it? in what context?
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
robvolk
Most Valuable Yak
USA
15566 Posts |
Posted - 07/27/2012 : 06:48:58
|
I know we're not supposed to reveal all our tricks, but you can have these two:
SELECT Rabbit FROM Hat
INSERT Sleeve VALUES(Null) |
 |
|
|
Transact Charlie
Flowing Fount of Yak Knowledge
United Kingdom
3448 Posts |
|
|
russell
Pyro-ma-ni-yak
USA
5037 Posts |
Posted - 07/29/2012 : 18:24:32
|
| It is garbage/huge security hole that used to be built in with php befor version 5. |
 |
|
|
prasaditc55
Starting Member
8 Posts |
Posted - 07/29/2012 : 23:37:32
|
| I heard this question in interview.. |
 |
|
|
Transact Charlie
Flowing Fount of Yak Knowledge
United Kingdom
3448 Posts |
|
|
nigelrivett
Flowing Fount of Yak Knowledge
United Kingdom
3328 Posts |
Posted - 07/30/2012 : 05:49:38
|
merge rather than magic?
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
|
SQLJames
Starting Member
28 Posts |
|
|
Transact Charlie
Flowing Fount of Yak Knowledge
United Kingdom
3448 Posts |
Posted - 07/30/2012 : 10:40:23
|
well if someone asked me in an interview about magic tables I'd have to ask them what the hell they thought they were talking about. It would not be a good way to sell me on the company or development team!
Transact Charlie
Msg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. http://nosqlsolution.blogspot.co.uk/ |
 |
|
|
nigelrivett
Flowing Fount of Yak Knowledge
United Kingdom
3328 Posts |
Posted - 07/30/2012 : 11:11:39
|
>> popularly known as the Magic tables Possibly not that popularly known.
Googling there are some articles about this. I suspect this is someone trying to get a name accepted. Looks like some people have got together and referenced each others articles.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
|
xhostx
Constraint Violating Yak Guru
USA
261 Posts |
Posted - 07/30/2012 : 11:31:01
|
Some unintentional Errors could lead to some magic queries :P
-------------------------- Get rich or die trying -------------------------- |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48012 Posts |
Posted - 07/30/2012 : 12:47:59
|
My guess is its called magic tables as it automatically assumes the structure of triggering table. But there's no official documentation I can find on this though.
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
subhaoviya
Posting Yak Master
India
119 Posts |
Posted - 07/31/2012 : 04:00:09
|
Magic tables are nothing but INSERTED, DELETED table scope level, These are not physical tables, only Internal tables.
This Magic table are used In SQL Server 6.5, 7.0 & 2000 versions with Triggers only.
But, In SQL Server 2005, 2008 & 2008 R2 Versions can use these Magic tables with Triggers and Non-Triggers also.
Using with Triggers: If you have implemented any trigger for any Tables then, 1.Whenever you Insert a record on that table, That record will be there on INSERTED Magic table. 2.Whenever you Update the record on that table, That existing record will be there on DELETED Magic table and modified New data with be there in INSERTED Magic table. 3.Whenever you Delete the record on that table, That record will be there on DELETED Magic table Only.
These magic table are used inside the Triggers for tracking the data transaction.
Using Non-Triggers: You can also use the Magic tables with Non-Trigger activities using OUTPUT Clause in SQL Server 2005, 2008 & 2008 R2 versions.
|
 |
|
|
khtan
In (Som, Ni, Yak)
Singapore
16769 Posts |
Posted - 07/31/2012 : 04:14:44
|
if Magic tables = INSERTED / DELETED then Magic Query is query that uses INSERTED / DELETED.
That must be it. Yeah ! I got the job. Now how much are you offering me ? 
KH Time is always against us
|
 |
|
|
nigelrivett
Flowing Fount of Yak Knowledge
United Kingdom
3328 Posts |
Posted - 07/31/2012 : 04:16:24
|
Where do you get the name "magic" for these tables?
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48012 Posts |
Posted - 07/31/2012 : 09:47:57
|
quote: Originally posted by subhaoviya
Magic tables are nothing but INSERTED, DELETED table scope level, These are not physical tables, only Internal tables.
This Magic table are used In SQL Server 6.5, 7.0 & 2000 versions with Triggers only.
But, In SQL Server 2005, 2008 & 2008 R2 Versions can use these Magic tables with Triggers and Non-Triggers also.
Using with Triggers: If you have implemented any trigger for any Tables then, 1.Whenever you Insert a record on that table, That record will be there on INSERTED Magic table. 2.Whenever you Update the record on that table, That existing record will be there on DELETED Magic table and modified New data with be there in INSERTED Magic table. 3.Whenever you Delete the record on that table, That record will be there on DELETED Magic table Only.
These magic table are used inside the Triggers for tracking the data transaction.
Using Non-Triggers: You can also use the Magic tables with Non-Trigger activities using OUTPUT Clause in SQL Server 2005, 2008 & 2008 R2 versions.
Can you guide us to any official documentation which has a reference on this?
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
Transact Charlie
Flowing Fount of Yak Knowledge
United Kingdom
3448 Posts |
Posted - 07/31/2012 : 10:18:37
|
there is no reference to Magic on BOL.
Transact Charlie
Msg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. http://nosqlsolution.blogspot.co.uk/ |
 |
|
|
DonAtWork
Flowing Fount of Yak Knowledge
2113 Posts |
|
| |
Topic  |
|