|
I noticed that there was no general mega-thread for SQL related questions, and I happen to have a small one, so I figure I may as well create a general thread for stupid/small questions having to deal with any flavor of SQL. Here's mine: The boss says that there is a bug in the where clause of the correlated subquery at the end having to do with the date, but I'm not seeing it. code:
ATTENTION: PLEASE USE THE INSTANT SQL FORMATTER this handy tool will format your SQL code into something remotely readable. Just look what it did to the above chunk of garbage: code:
uh zip zoom fucked around with this message at 01:01 on Nov 2, 2007 |
# ¿ Nov 1, 2007 19:52 |
|
|
# ¿ Apr 28, 2024 17:34 |
|
uh zip zoom posted:I noticed that there was no general mega-thread for SQL related questions, and I happen to have a small one, so I figure I may as well create a general thread for stupid/small questions having to deal with any flavor of SQL. Here's mine: Okay, apparently the problem was not so much my query but my lack of understanding of what the databases used for and how and why data is entered into it, so basically I needed to find dates that were greater than today, not dates that were smaller than, so it should have been: code:
|
# ¿ Nov 1, 2007 20:36 |
|
ashgromnies posted:It's kind of hard to identify the issue with such limited information. the query returned unintended results, because I misunderstood the purpose of that column. I considered using cast to make getdate() a smalldatetime like the other side of the compare, but that really didn't have any effect. Yes, the naming conventions are very confusing, and it's kind of a mess that I've inherited, but I've only been there a month and the position is entry-level. Sorting all of that out is one of my long long long term goals.
|
# ¿ Nov 1, 2007 21:07 |
|
m5 posted:Personally I think it's risky to perform relational comparisons on fields that might be null. That's what COALESCE and ISNULL (MSSQL) and CASE are for. thanks for the heads up on that link. I'll bookmark it. Hopefully other people get from the thread title that this is intended to be a general small questions thread for SQL.
|
# ¿ Nov 2, 2007 00:56 |
|
I'm trying to use Microsoft Excel to build a script to insert spreadsheet data (and not the headers) into an MS SQL database, unfortunately I don't know jack about (read: forgot the first time I was told) the syntax involved with creating a string with Excel. Help?
|
# ¿ Nov 27, 2007 01:29 |
|
in MS SQL, I'm trying to alter a nullable integer column so that it's not null with a default value of zero. How could this best be done using a constraint (since I believe that's the only way to go about it, since I don't believe you can add default values when altering a column)?
|
# ¿ May 27, 2008 22:28 |
|
Xae posted:Update the Column, set =0 where col is null suppose a user adds a record and doesn't include a value for the column that has the default value, will that field still get said default value?
|
# ¿ May 27, 2008 23:34 |
|
|
# ¿ Apr 28, 2024 17:34 |
|
Alex007 posted:
yes, yes it is. Thank you very much.
|
# ¿ May 28, 2008 00:11 |