« first day (2583 days earlier)      last day (1735 days later) » 

6:43 AM
why double quotes?
@J.L.Louis what you using? ms sql? mySql? oracle?
also you are searching for FC as a number and varchar ... i mean you should decide which type that column is
 
7:17 AM
xm... it may be completely wrong, but wrap in quotes the numbers, too
 
integers dont need to be wrapped around in quotes
the double value is weird though as its nothing he has every refered to
i think i know where this is going wrong
but id need some data
 
problem is that DB is converting FC column to int when its comparing it with value of 1753, 1754 (or any other integer value)
 
morning guys
 
and it can't convert 'S1ZJK2' to number ... so he suppose to wrap numbers into quotes and compare all data as varchar
FC in ("1753", "1754", "1755", "C1TABA", "C1TABB", "C1TABC", "2021", "2022", "P1ZHBC", "Q1ZHA2"));
would work
 
ohh shit ur right
 
7:27 AM
exactly :-)
 
its early i need more coffee
 
so it see int and then tries to convert the string to int :-)
 
hey, today i just turned 30 ... couple of thousand more problems and ill be wise and old ...
 
Happy Birthday man!
 
thanks man
hmm didn't know that @gotqn nice share
 
7:29 AM
happy birthday :-) come to EU and leave Russia and Putin away :D
yes, there must be something like this in other database, too
 
hehe nice one @gotqn
 
@Veljko89 happy birthday mate
 
thanks bro
 
7:42 AM
Happy Birthday @Veljko89
 
8:19 AM
thanks man
 
8:48 AM
Morning!
ey @Veljko89 happy birthday to ya
 
thanks Sami
 
9:12 AM
Morning y'all
ah cool HB @Veljko89
 
thanks @Shaneis
 
 
2 hours later…
11:41 AM
Guys, could you recommend any good documentations which I could refer for understanding internal architecture of Index, page structure, b-tree structure.. etc in SQL Server
 
Hi All, Any one has to the query to fix the DB index fragmentation based on the fragmentation percentage ?
 
xm... SQL Server?
 
Yes Please
 
which version? why not using the build-in job?
 
11:56 AM
I want to execute with query whenever I want
rather than job
 
if you are running Enterprise you can rebuild indexes online, if not
there are locks holds during the operation, which will block other queries, so execute only when there is no activity or less activity
 
yep
Thanks
 
12:13 PM
Hi guys
I am using mysql database and in my database table I am having 1 million records which I need to fetch and show in the webpage in table format. I am looking for best solution to let this happen but problem is that I have looked over google but didnt get right solution...
can someone suggest me?
 
12:27 PM
@Exception question is not clear enough bro
what's happening
what have you tried?
 
issue is I have million of records and I want to show them over web page but as soon as web page loads, the webpage stuck because I am fetching too much data which is valid
 
12:49 PM
don't show all of them :)
one million rows to be shown to a user is too much information
add paging - but server side paging
so create one query to get
1. total rows
2. rows to each page
the second is important
it should be something like
Row
1 1001, 1002, 1003, 1004, 1005
2 1006, 1007, 1008, 1009, 1010
for example showing only 5 records per page
then load only the first page
if the user click next or jump to a page - use the IDs to performing filtering
all other types of paging - client sire or server side using OFFSET are slow, because they are touching all the data
 
@Exception
THis is what you are looking for
SELECT * FROM table LIMIT 10 OFFSET 10
SELECT * FROM table LIMIT 10 (brings 10 rows) OFFSET 10 (skips first 10 rows)
 
1:10 PM
@here but even if I added pagination @ server side then still it will take time to load on the very first page. Shall I need to make any changes at server side, query side, mysql side?
 
exactly
leave standard paging solutions
do it like I said
count the rows, based on that count and page size, calculate which ID needs to be shown on each page
then filter for 20,50 or 100 IDS - your query will fly
 
I hope that this will not loose site performance
 
 
1 hour later…
2:26 PM
Thanks @Veljko89 !
 
@gotqn you are a power user
 
 
1 hour later…
3:47 PM
I have this query:
select asset.*
from asset
inner join software on asset.asset_id = software.asset_id;
I'd like to update asset, set model = software.NEW
but only on the records that resulted from the prior query
so only the records where asset.asset_id is also in software.asset_id
 
 
2 hours later…
6:16 PM
guys, have a nice weekend
 
hya
i am kinda confused right now
I thought you could easily use triggers to do additional checks on insertion and prevent the inserts when some stuff is not how you want it to be
but I just tried it and it doesnt really work the way I expected it to work
and I cant find stuff on google about it
for example
create trigger trig
on Person
after insert
as begin
	if exists(
		select *
		from inserted
		where name = 'Wietlol'
	)
		throw 50000, 'Wietlol is a reserved name.', 1
end
if I would attempt to insert a person with the name "Wietlol", it would throw the error and prevent the insertion
except that... it does throw the error but the record is created
I understand that an instead of trigger would be much better
but in that case, I need to write the queries for the regular behavior if the name is not Wietlol
for insert, that isnt a big deal, but for updates, it is
 
6:57 PM
can anyone explain what I am doing wrong here?
 
 
3 hours later…
Jay
9:50 PM
I have a datetime column that I'm converting to a date, but I also need to check if it's null or not, but when I run it I get an error that says 'int is incompatible with date' and it's starting to hurt my head
ISNULL(CONVERT(DATE, icl.recievedDate), 0) AS Received
If it is null I need to make it a zero instead so I can do math on it later, but if it's not a null I just need the date
 
 
1 hour later…
11:12 PM
@Jay That because the 0
SQL Server will try to convert the 0 to a DATE
because INT has lower precedence than DATE
@Wietlol Hey
You just specify AFTER INSERT in your trigger, thus the data will be inserted
Also, in your query, did want to check the table Person or the pseudo INSERTED? Think of that
but, trigger will throw the error anyway, after the row is inserted
Clearly you want to prevent inserting, so I suggest that you use a CHECK constraint instead of a TRIGGER
and if you insist to use a TRIGGER then use INSTEAD OF INSERT, UPDATE
If you are looking for preventing 'Wietlol' to be inserted then
CREATE TABLE Person(
  Name VARCHAR(45) NOT NULL,
  CONSTRAINT CHK_Person_Name CHECK(Name <> 'Wietlol')
);
This ^ will do that
If you are trying to make the name UNIQUE then create a unique index
eg:
CREATE UNIQUE INDEX IX_Name
ON dbo.Person(Name);
 

« first day (2583 days earlier)      last day (1735 days later) »