Wednesday, March 21, 2012

Open table + NULLs

In SQL Management studio, if I right-click on a table and click "Open table", it brings up the table, similar to return all rows in 2000. But if I go to the last row, and edit data in a cell and the word "NULL" is that cell because there is a Null value there, it actually keeps the word null in there as in "NULLnewdata".

Am I doing something wrong?My first suggestion would be to use an UPDATE statement to modify data, not

the resultset.

After that, make sure you have highlighted the word "NULL" before you start

typing...

wrote in message

news:1305c385-434d-4f39-8ee2-993fecab5184@.discussions.microsoft.com...

> In SQL Management studio, if I right-click on a table and click "Open

> table", it brings up the table, similar to return all rows in 2000. But

> if I go to the last row, and edit data in a cell and the word "NULL" is

> that cell because there is a Null value there, it actually keeps the

> word null in there as in "NULLnewdata".

>

> Am I doing something wrong?

>|||

Those are nice work arounds, but it seems to me like this is not the behavior that should be happening in the UI.

|||Well, I think part of the problem is your method. When I highlight a NULL

value in Management Studio, it highlights the word. When I start typing, it

replaces the word altogether. I can only reproduce your behavior if I

highlight the cell, then click again. And I think had I happened upon that

behavior naturally, I would have just remembered to not do it again.

Sure, it's not the most intuitive thing in the world. But based on the

number of people who are going to do it, my gut tells me that it will stay

that way.

You should still be using DML statements for modifying data, rather than

relying on a GUI that is imperfect. Just because I can ride my tricycle to

work doesn't make it the best choice.

A

wrote in message

news:c9dd504e-ee88-4d2e-a773-24ae795050a5@.discussions.microsoft.com...

> Those are nice work arounds, but it seems to me like this is not the

> behavior that should be happening in the UI.

>

>|||"Correct" method or not, I am just confirming that this is a bug and someone else is having the same issue, and it was not because I have an old build or something.
(They did have 5 years to test it) :)|||To be quite honest, I'm not sure how much usability testing went into these

parts of the tools... most of them are holdovers from Enterprise Manager,

with a different look and feel. I was going to say prettier but I think the

jury is still out on that one.

wrote in message

news:bc733a59-8d05-452c-ab75-9b9e0d570fa7@.discussions.microsoft.com...

> "Correct" method or not, I am just confirming that this is a bug and

> someone else is having the same issue, and it was not because I have an

> old build or something.

> (They did have 5 years to test it) :)

>|||

I don't think there is a code defect here. I think it's just the way the grid metaphor works. We tried to make sure our grid controls work the same as other Microsoft grids so that whatever learning people have invested in other Microsoft products applies to SQL Server and Visual Studio. The same thing you're describing here happens to me occasionally in other grid-centric products, such as the grid in Microsoft Excel. I've just had to learn to make sure the cell contents are completely highlighted before I start typing to replace them.

In the case of the open table editor, once you change the cell contents, the open table editor replaces the DBNull value in the data set with whatever the cell contains. The open table editor doesn't know what you mean to have in the cell, so if you edit the cell contents to say "NULLnewdata", then that's what it changes the field data to.

|||

I see that this thread is ancient (in internet time!) but I have a highly similar question: I want to go the other way. That is, I want to NULLify a cell in the grid. Deleting the cell contents doesn't work (unless it's a char field) and typing 'NULL' doesn't work either (incorrect data type, or I get the string 'NULL' stored in the field). Is there any way to have a true NULL 'inserted' into a cell, through the grid control? Or can this only be done through DML?

Thanks,

Tom

|||

Tom,

I don't think you can enter NULL values into a cell by typing something. However, there is a trick. You can either find another NULL value in the grid or go to the very last row of the grid where a bunch of NULLs are listed. Then just hit CTRL+C to copy the value and CTRL+V to paste it to the cell you want to add NULL to.

Thanks!

|||Three things.

1.) Ctrl-0 (read control-zero) = NULL

2.) Saying that that's the expected behavior is a cheap Cop-out.

Enterprise Manager 2000 did it just fine. There is NO REASON that

the "new" "improved" product can't clear out a cell with a null value

as soon as it has the focus. I know it's Friday, but c`mon.

3.) One thing I've noticed is that Management Studio was obviously

written *by* and *for* Visual Studio .NET programmers. All other

developers (VB6, ASP, C, C++, SQL, MS Access...) got screwed. The

one thing enterprise manager 2000 was good at was building

queries. It did a good job. SQL Mgmt. Studio sucks at

that. It does a horrible job. It takes me 20-30% longer to

write queries in the new software. Let me run enterprise manager

against SQL Server 2005 to build queries and I'll be a happy man.sql

No comments:

Post a Comment