Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Server preview mode ?

Author  Topic 

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-08-12 : 04:11:59
Hi
is there a preview mode in SQL server?

I think there is a way of previewing a command before executing

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-12 : 04:17:41
Nope. what do you want to preview?
Go to Top of Page

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-08-12 : 04:24:39
I think there is , I remember seeing someone doing it ..
for example i want to UPDATE a table , so i need to preview it 1st to see how many rows are updated,
what i do now is :
[CODE]
SELECT * from A
where conds...
[/CODE]

Before executing
[CODE]
UPDATE A set field1 = 2, field2 = 3....etc
WHERE conds
[/CODE]

to make sure it returns only the rows i wanna update,

but there is some preview mode .. like in Oracle..
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-12 : 04:54:03
no. there's no such thing.

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-08-12 : 04:57:03
[code]BEGIN TRAN

UPDATE A set field1 = 2, field2 = 3....etc
WHERE conds

ROLLBACK[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-12 : 04:58:12
ok... that'd work. you just have to remember to put it there.

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-08-12 : 05:01:46
and remember to take it out later


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pazzy11
Posting Yak Master

145 Posts

Posted - 2008-08-12 : 05:12:23
thats it .. or I just COMMIT after ROLLBACK ?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-12 : 05:13:47
either commit or rollback.

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-12 : 05:20:24
quote:
Originally posted by pazzy11

thats it .. or I just COMMIT after ROLLBACK ?



once you ROLLBACK you wont have any active transaction to COMMIT. so you need to start transaction again and do commit.
Go to Top of Page
   

- Advertisement -