« first day (1626 days earlier)      last day (3245 days later) » 

12:27 AM
@mmarie I have never noticed that before. It must be new.
 
 
6 hours later…
6:51 AM
0
Q: how can i execute data fast from MySQL without indexing

Kuldeep SinghI have a MySQL table which contains around 2-3 hundred thousand recors and i want to execute data fast without indexing. So how can i do that ? i think we can use group by but not sure. Any Help !

 
7:11 AM
Hi. @ypercube I'm breaking my mind here. it looks so simple but I cant understand the locig behind this :
SELECT *
FROM   testA
       JOIN testB b
            ON  testA.id = b.id
WHERE  id = 2
testA and testB are dup tables. identical
why do I need prefix testA in the where id=2 ?
I tells me :
Msg 209, Level 16, State 1, Line 10
Ambiguous column name 'id'.
 
because both tables have an id column
 
I need to change it to WHERE testA.id = 2 on order to work
I know but :
why sql doesnt know to take WHERE id = 2 from the non aliased table ???
 
Because the result of the FROM is a table with 2 identically named columns.
 
but I didnt write where b.id = 2
so id ,must belong to the non aliased table
 
What if you change the ON testA.id = b.id to USING (id)? Do you get the same error?
@RoyiNamir No, you have that wrong.
Both tables have names/aliases.
 
7:14 AM
@ypercube It looks like SQL Server, so USING won't work
 
The first is named testA, the second is (aliased) b
 
(sql server)
ok...?
 
This is wrong: "so id ,must belong to the non aliased table"
There are no non-aliased tables.
 
If you do not specify an alias explicitly, the default alias is the table's name.
 
7:17 AM
You may be thinking of correlated subqueries:
 
love you guys :-)
yes now it's all set into my mind
 
SELECT *
FROM test a
WHERE a.id = (SELECT id FROM test WHERE id = a.id) ;
You are allowed to use id inside the subquery.
 
Not allowed but must....right ? (otherwise how would it know the outer table....?)
 
It's the same as:
SELECT *
FROM test a
WHERE a.id = (SELECT test.id FROM test WHERE test.id = a.id) ;
SELECT *
FROM test a
WHERE a.id = (SELECT b.id FROM test b WHERE b.id = a.id) ;
@RoyiNamir If you want to refer to the external table, yes, you have to use a.id
 
So sql is smart only with single level ?
SELECT *
FROM   testA
WHERE   id=2
(no alias/name in where clause)
 
7:22 AM
It's nothing to do with smartness
In the subquery, the subquery FROM has only one table, so any non-aliased column is first checked against that table. Then if that table has no such column, the external scope is checked.
Best advice: just alias everything
 
oh ok
 
Well, at least alias everything when more than one table is involved.
 
One more small question : I aksed a question about update table A from table B according to certain values.
so there is this syntax :
UPDATE testA a
SET    a.[Content] = b.Content
FROM   testB b
WHERE  a.PageID = b.pageID
       AND a.PageID = 2
But another guy told me it's wrong since it's not ANSI SQL
He told me to use explicit join :
UPDATE Dest
SET    [Content] = a.Content
FROM   EServices_Pages_Content Dest
INNER JOIN [dstrn].weberp.dbo.EServices_Pages_Content a
    ON Dest.PageID = a.pageID
    ...
WHERE a.PageID =2
Is there a difference ?
 
It's the same thing. But I prefer the second, too.
By the way, tell him that the second is not ANSI either. ANSI SQL does not have [ ]
 
The first one wouldn't work in Transact-SQL because of the alias a in the UPDATE clause. You could just remove the alias and replace a everywhere in that query with testA.
 
7:28 AM
ps Would be a shame to ask what is the difference between Transact-SQL VS what i'm writing in sql queries ?
 
@RoyiNamir His "Explanation" seems good.
 
@ypercube Yes But I didnt like the way he changed my query instead of resolving the actual issue
 
@RoyiNamir OK but he still solved the problem.
Your answer is ok, too
 
it's just that the second query(which you like) seems too verbose...no ?
 
@RoyiNamir I don't know.
Do you prefer to repeat EServices_Pages_Content in 5 different places?
Or just the alias Dest ?
 
7:34 AM
no :-)
Yes you're right
Again , as always , thank you guys
 
@RoyiNamir He probably wanted you to start using explicit joins in UPDATE instead of implicit joins. Kind of a good practice suggestion. If I were him, I'd probably first suggest an easy fix, then offer a "good practice" solution.
 
I've also seen updates where the table is repeated in both UPDATE and FROM and the statement.
But that can cause other issues.
 
@AndriyM Yes I agree. I prefer to be corrected , and then be shown the other way. ( im not talking about cases where my starting point is completely wrong. my starting point was good)
 
And really, this one:
And according to the last article, the UPDATE ... SET ... FROM ... syntax is not ANSI SQL.
But the guy who answered your question was referring to using JOIN instead of WHERE.
Not a very valid remark, considering that the UPDATE in sql-server deviates from the standard.
 
Personally I don't have much against the shorter syntax. It's just that very often the updated table's name is rather long and so repeating it multiple times in fully qualified column names makes the query less readable (sometimes even longer than with the longer syntax). I'd be happy if Transact-SQL started supporting the UPDATE table AS alias syntax.
Still, being forced to use explicit joins has its benefits too. An UPDATE with an explicit join is much easier to convert to a SELECT for debugging purposes
 
7:45 AM
(I have found that the UPDATE is one point where it's very hard to write code that runs in different dbms)
 
Perhaps CTEs can make it easier (in cases where all the target platforms support CTEs, of course).
 
@ypercube It would be great if you could correct him , for other people not to be confused and misled - when reading his answer.
 
8:00 AM
I don't understand — the SQL ISO (contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt) says :
Format :
 <update statement: positioned> ::=
              UPDATE <table name>
                SET <set clause list>
                  WHERE CURRENT OF <cursor name>

         <set clause list> ::=
              <set clause> [ { <comma> <set clause> }... ]

         <set clause> ::=
              <object column> <equals operator> <update source>

         <update source> ::=
                <value expression>
              | <null specification>
              | DEFAULT

         <object column> ::= <column name>
I dont see any joins here
 
@RoyiNamir Yes, that's what one of the articles linked by @ypercube says. The author proposes deprecation of the FROM clause in UPDATE and DELETE because it's proprietary syntax.
@RoyiNamir Or what specifically confuses you?
 
The guy who answered me , is wrong
that's what makes me uncofterable
....someone is wrong on the internet....thingy
His answer is also nonANSI
You are welcome to post an answer. I unchecked his and commented him,
 
@RoyiNamir it's your question, un-mark his answer, explain... ask @Andriy to add his answer, mark his :)
@RoyiNamir ^^ that
 
@Marian 2 sec delay ^ :-)
amazing
 
@RoyiNamir nope, my internet is slow today
or I'm slow, same thing :)
 
8:15 AM
oh boy ...(Hackintosh is frustrating process...) {not realted , just sharing my pain :-=)}
 
8:26 AM
Someone needs a guillotine:
http://dba.stackexchange.com/questions/104403/how-can-i-execute-data-fast-from-mysql-without-indexing
 
@RoyiNamir His suggestion is good. My only problem is with his Explanation part.
 
Yes. I agree. but readers might easily misled by his wordings. he's not clear. the only good part is the 10% where explicit is prefered than implicit
That's all
Nothing less nothing more
Not to mention , as you told him - that his statement that implicit join are deprecated — is incorrect
 
@Colin'tHart Perhaps they want a CSV without the header line :)
Beheaded data
 
Hehehe
 
8:55 AM
@RoyiNamir: To me it would seem best if you updated your answer. If I were in your situation and had just learnt what you've learnt, I would add to my self-answer that in the long run I would probably use explicit joins, explain why, credit the person who suggested that, explain the reasons why I didn't accept his answer (unaccepting his answer accordingly) and accepted my own answer.
But that's something I would do, you should decide for yourself. I'm not posting an answer because it would only correct the other answerer without suggesting anything new. That's what the comments are for and I've used them for that.
On the other hand, you could wait and see if Zohar comes up with an explanation that works for you.
 
9:19 AM
Seems like he's just updated the answer.
 
9:35 AM
Andriy , do you know ssmsBoost ?
Great tool. ( just a suggestion)
(free for 2008 , not for 2012)
 
9:48 AM
Thanks. Never heard of it, seems interesting.
 
Usefull usages
Also for varbinary :
 
The free 2008 version has all that?
 
yep
Also , imagine large SP where many tables (join etc). you want to go to that table :
no problem
at the same connection you're already at.
you want to go to that table in another server ? no problem just "set connection as"
What about finding within the search results ? no need to add Where :
One of the best parts :
We have a trigger in the DB level :
which capture every change to DDL
so you can see that it captures all changes to the master table :
but if you copy paste via CTRL+C you get one long line!
this is a problem if you have remark with -- select , since you wont know where the remark ends
but !
if you use the third option here ( copy current cell) - it will be copied with line breaks and indentations !
@AndriyM Are you here ?
Well , just wanted to share this great tool
 
10:06 AM
I am
Thanks for this introduction. I'm already impressed by what you've shown and I can see there are other options too.
I'm usually reluctant about add-ons and go very slowly about including them into my workflow. This one seems worth spending your time learning it.
 
Another usefull thing ( which will be enhanced next version - I talked to the author) - is that you can create a table variable from the result grid !
Here :
(the thing which will be enhanced is that - currently it treat the results grid all as nvarchar. in the next version it will be the ACTUAL TYPE)
this is good for sharing FIddles
you just do select , and it creates a table which contains the grid results. just copy and paste
trully nice.
Here is my email to the author about it. he will fix it next version
 
10:24 AM
good morning everyone
I have a sql table and in a col which is of float type and stores datetime in float type
 
Stop right there
Why?
 
to convert datetime to double I use SELECT CAST(CONVERT(datetime,'2009-06-15 23:01:00') as float)
but date is yyyy-mm-dd
how to convert from dd-mm-yyyy
 
How about you store dates properly? Then all your problems go away
 
I am java developer and I dont know for which purpose they are stoing in float type
I am just working on existence table and ofcource in existing DB
so I can not change the datatypes
I tried with 110 also but this doesnt work
 
11:02 AM
Real programmers (as in Story of Mel)
 
11:27 AM
@SpringLearner Sorry, I'm not sure I got it right. Your application passes strings that represent dates in the dd-mm-yyyy format to a SQL query, and you want the query to convert the strings to datetime and ultimately to float?
@ConcernedOfTunbridgeWells It never ceases to impress me that the Spectrum version of Elite managed to fit into 48K.
 
12:06 PM
@AndriyM dates are stored in float format
I want to retrieve the value in datetime as dd-mm-yyyy
format
I have finally found the answer from here
thanks anyhow for reading my question and trying to help
 
Ah, so you want to display them in that format. Although you can do that in SQL, it might be a better idea to do that in the application
 
yes but the problem is if I do in my application then its giving me wrong values
I am getting 2 days extra
so I am forced to do sql function
 
That's probably because you are retrieving the values as floats and do both the conversion and the formatting in the application. I've encountered this 2-day difference issue in Delphi too. I was talking about formatting only. Convert the data to datetime and return them as such. Of course, your application should read the values as datetime values too.
Still, I know little about Java, so maybe it's not very easy to set this up correctly in Java.
 
12:21 PM
well my application wont use much this function 'CAST(CONVERT(datetime,'"+deliveryDate+"',105) as float)'
so I can use this way right?
 
@SpringLearner What is the datatype of deliveryDate? Are you sure it is float?
 
12:39 PM
@ypercube yes
 
So, how is 2015-06-18 saved as?
what value?
 
its a date ,I am saving as datetime
for example to store current date and time
I am using the following function
CONVERT(FLOAT,getdate())
 
OK. then the CAST(CONVERT(datetime, inputDate ,105) as float) seems good.
 
When you retrieve the value for the application, how do you do that? Just SELECT deliveryDate FROM tablename? (supposing deliveryDate is the column name)
 
12:56 PM
(feeling shame for relating "good" with this kind of code/design ...)
 
@AndriyM select convert(datetime,deliveryDate )
@ypercube can you tell me how to improve?
 
@SpringLearner And when your application reads that, it gets an incorrect date (by 2 days)?
 
no no
if I do this way ,then its giving right values
my formula was giving 2 days ahead
	public static  Date convertDoubleToWindowsTime(double comTime) {
		long result = 0;
		comTime = comTime - 25569D;
		Calendar cal = Calendar.getInstance();
		result = Math.round(86400000L * comTime)
				- cal.get(Calendar.ZONE_OFFSET);
		cal.setTime(new Date(result));
		result -= cal.get(Calendar.DST_OFFSET);

		return cal.getTime();
	}
sorry this is a java code
I used this first
this function accepts a double value
so I am retrieving the value from DB(which is float)
then passing in this function
the date which I get is 2 days ahead
 
@SpringLearner That's where I'm suspecting the problem. If the query returns the value as a datetime, why is application reading it as a float?
 
I think I am not clear
I apologize for it
In database,date and time is stored as float
so earlier to retrieve it and show date time in my java application
I was 1st retrieving as a float or double from DB
passing this double value in convertDoubleToWindowsTime functions
and after that I get the date and time
hope you understood now?
 
1:07 PM
You mean, that was before you started using CONVERT(datetime, deliveryDate)?
 
yes exactly
 
But now that you do use it, what is the issue? If you can return it as a datetime, and your application can read it correctly as a datetime, can it not format it? Do you have to format it in SQL? (That's where we started this.)
Maybe I missed something (again). Sorry if that is the case.
 
the problem was from front end I am getting dates in dd-mm-yyyy format
but SELECT CAST(CONVERT(datetime,'2009-06-15 23:01:00') as float) is using yyyy-mm-dd format
as this sql query is a part of my stored procedure
so I can not directly modify in sql server
so need to request to front end to send date format in yyyy-mm-dd format
this was my intention
 
Your front end, when it reads CONVERT(datetime, deliveryDate), reads it as dd-mm-yyyy? It probably reads and automatically converts it into a string, correct?
And for conversion it probably uses your system locale, which is configured to use dd-mm-yyyy for dates.
 
yes
well I need another help
is it possible to connect to sql server in remote system using public IP
lets take for an example,System A has sql server installed in it and System B which I am using has sql configuration manager
so to access sql server from System A ,I have to just pass IP address like 192.168.1.1
if both A and B are in same network
but if lets say system A is present in london and system B is present WC
and both in different network
 
1:19 PM
then you'd have to pass the public IP
 
then can system B access sql server of B?
Yes I have passed the public IP
 
That may involve configuring your firewall, but generally it should be possible
 
but it did not connect
I have disabled windows firewall from system A
 
Then there are other network/firewall issues
 
You may also need to specify either the port number or the name of the instance
 
1:21 PM
'B' may also not like certain outbound connections
 
telent does not work
when I do telnet 59.90.87.54 1433
it did not connect
 
But does it really use 1433? I'm not sure your System B configuration manager has anything to do with configuring a System A instance.
 
yes it uses 1433
System A has sql server and tomcat
so I am using localhost:1433
for public IP ,is there any modifications I have to in System A or in System B?
got a metting,brb
thanks again
 
1:40 PM
19 mins ago, by Mark Sinkinson
'B' may also not like certain outbound connections
So take a look at firewall on B
 
2:09 PM
@SpringLearner As others said before. Don't use float to store dates
 
2:31 PM
apparently we're going to start POC-ing Tableau
@ypercube s/dates/most things.
 
@swasheck Last company I worked for was an authorized reseller for them.
I lived in Tableau for about 1.5 years
 
ohboy
 
Yeah, the BI peeps liked it a lot.
 
Not a TMNJ fan but I might need this for my collection shirtpunch.com/designs/details/blue-ninja
 
J?
 
2:46 PM
@AndriyM The BBC version used to fit into 32K and they had to use a custom screen mode to save some space from the frame buffer. The top 32K of the Model B's address space was taken up by the OS and BASIC ROMs.
(source: I played Elite rather obsessively when I was 14.)
Somebody managed to get a playable chess game onto a 1K ZX81.
1K ZX Chess is a 1982 chess-playing computer program for the unexpanded Sinclair ZX81. == Description == 1K ZX Chess uses only 672 bytes of RAM but implements most chess rules (castling, promotion, and en passant capture are missing), and a computer opponent. It was the smallest implementation of chess on any computer until its record was broken in January 2015 by the smallest completely new PC compatible BootChess, although apparently artificial intelligence is lesser than the original. Developer David Horne discussed 1K ZX Chess and published the full source code in a series of articles in Your...
Also, The Story of Mel, a Real Programmer:
3
 
@swasheck We use it for internal reports, pretty cool reporting dashboards with it.
 
@ShawnMelton does it have its on ORM?
 
That I am not positive, they don't let me play with it :)
 
@swasheck Could be worse. Could be Qlikview.
 
@ConcernedOfTunbridgeWells Interesting!
 
3:02 PM
@swasheck It has a metadata layer and some sort of in-memory engine.
 
I remember writing my first self-modifying program. a really good feeling
 
i'm just sick of cognos with it's crummy ORM. if we could force people to use SQL and then let the application handle the caching then ... WIN
 
@ypercube I can't remember ever doing self-modifying code but I can remember breaking the copy protection on various games that made use of self-modifying code to obfuscate it.
@swasheck But that would mean your report team would have to learn to program.
 
@ConcernedOfTunbridgeWells we have a dedicated team of well-paid report developers (read: click-and-draggers) and then a team of well-paid business analysts who click on the deployed clicked-and-dragged objects to print and then deliver them to the end-user.
somehow we still make money hand-over-fist here
 
@ConcernedOfTunbridgeWells was trying to solve the Knight's Tour problem. The program (in Z80A) was using around 20 bytes for code and 120 bytes for the data.
I realized shortly after running it, that the universe time would not be enough to find a solution.
 
3:13 PM
@ConcernedOfTunbridgeWells "After Mel had left the company for greener pa$ture$…" – what a nice turn of a phrase and use of special symbols! Only in English.
 
DO THEY SPEAK ENGLISH IN WHAT?
 
What?
 
SAY WHAT AGAIN, I DARE YA
 
0
Q: How do I return records based on which records only exist during a certain time period?

short_busI've got a table of invoices and customer codes. I'd like to pull only the customers that have not done any business with us since 2009. My regular select statement is simple SELECT INVOICE.CUSTOMER_CODE FROM INVOICES WHERE INVOICES.ORDER_DATE <= '01-01-2010' But, this statement also pulls c...

does this really belong on Stack Overflow?
 
@jcolebrand what i want to know is whether he's using a 45 or 33 1/3 record player
 
3:18 PM
@jcolebrand I'd say so. The answers are so SO, too ;)
 
@swasheck you've heard this song before then? :p
 
yes. sometimes is skips and then just repeats itself
 
Is there a nuance of "this is more complex than just selecting records"?
Also, can we make the answers more teaching?
I'm not saying we can
I'm just contemplating
 
no nuance.
 
@swasheck :p
 
3:19 PM
@jcolebrand I did not mean that we should send it to SO.
 
also ... op is named short_bus so stackoverflow seems to be the appropriate home ;)
^^^ plenty of nuance
 
3 answers and no one noticed the date format
 
@ypercube that's because @AaronBertrand is on SQLCruise
 
so true
 
3:37 PM
@ConcernedOfTunbridgeWells thnx for the story of Mel. Searching the net for the real Mel, one can find a photo of him. And also some hand written code: bemorehealthy.com/LGP-30Computer/P5300874.htm
 
3:48 PM
@ypercube Yes, a Hamilton Circuit of a chess board.
 
@ConcernedOfTunbridgeWells Oh look, you have a picture of our sharepoint server
 
And, in the same vein, a brute-force solution to the seven bridges problem.
 
4:06 PM
@ypercube I did when I asked if it really belonged there
 
@jcolebrand yeah, I got that. I didn't want you to think that I was pushing for kicking it. Gone now, thnx to you ;)
 
 
1 hour later…
5:15 PM
You guys are actually talkative today
 
5:47 PM
except for right now
 
6:04 PM
It's been a busy week.
 
What happens on #sqlcruise stays on #sqlcruise @AaronBertrand and @Neil_Hambly http://t.co/t74vMTtUZ5
Just something to brighten everyone's day
 
hehe
 
@mmarie we saw you coming :p
 
6:44 PM
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
 
6:56 PM
@KrisGruttemeyer whoa...
 
i'm going to make that my new avatar
 
@swasheck why did you meet Cal Ripken Jr?
 
he came to my place of employment
 
 
1 hour later…
8:19 PM
@ypercube It's hypnotic. Every time I click back to this window I stare at it. And I know AB and NH are staring back at me
2
 
8:39 PM
Looking longingly into the camera...
 
8:49 PM
If you think that making columns not nullable and then populating every text column with 'NONE' makes the data cleaner, you are wrong. So amazingly wrong it makes my eyes bleed. Doubly so when you realize you can't use 'NONE' in your state columns because it's varchar(2) so you use 'OO'
</rant>
 
@billinkc Ew
Time to go buy a new dev laptop. New electronics smell, here I come!
 
9:29 PM
Automate it with BIML and let us never speak of why you have 1000 columns to unpivot — billinkc 11 secs ago
 
 
2 hours later…
11:00 PM
Hi
I heard Hercules could unpivot over 1000 columns
 

« first day (1626 days earlier)      last day (3245 days later) »