« first day (1830 days earlier)      last day (2488 days later) » 
04:00 - 14:0014:00 - 17:00

2:00 PM
i have record in datatype nvarchar(255) value 2828
when i use this query
select * from test where Value BETWEEN CAST(100 AS nvarchar(255)) AND CAST(300 AS nvarchar(255))
i got the record but it is not Logical because 2828 not between 100 and 300
 
Why not :
N'100' and N'300'
BETWEEN N'100' AND N'300';
 
same result
 
It is if you store it as nvarchar
 
it is nvarchar but i need it nvarchar how i can solve it
 
Cast it as INT
then
WHERE cast(col as int) < value and cast(col as int) >value
 
2:07 PM
it is work
thank you
 
wellcome ;)
@IbrahimAlsurkhi Or you can do it as
SELECT * FROM T WHERE cast(Col as int) between 100 and 300;
 
when i have date or name in record i have a error Conversion failed when converting the nvarchar value 'x' to data type int.
Value BETWEEN CONVERT(int,200) AND CONVERT(int, 300)
data stored in value can be number or date or string
 
So use LIKE
 
like between ?
 
No
 
2:15 PM
how to use like with between
 
WHERE Col Like
OR Col Like
 
i think i can't use like with greater than and less than
 
Can you show sample data?
 
hey @IbrahimAlsurkhi, why are you storing numbers or dates or strings in the same column?
 
I don't know , It's bad
Let's see sample data
 
2:19 PM
it is old project i can't change database structure
 
Ok , what is the outputs you need?
 
i need get
result from
select * from DossierDataValues where FK_FieldId=2040 AND Value BETWEEN CONVERT(int,200) AND CONVERT(int, 300)
get between int and int
 
what database are you using?
 
SQL Server as you see @Shaneis
 
sql server
Conversion failed when converting the nvarchar value 'ibrahim' to data type int.
 
2:23 PM
Try TRY_CONVERT
 
@IbrahimAlsurkhi CONVERT(int,200) ? are you sure?
 
CONVERT(int,'200')
 
select * from DossierDataValues where FK_FieldId=2040 AND TRY_CONVERT(int, Value) BETWEEN 200 AND 300
 
'TRY_CONVERT' is not a recognized built-in function name.
 
2:27 PM
what is the result when you run this:
SELECT @@Version
 
2008
hahaha
TRY_CONVERT is for 2012+
 
Microsoft SQL Server 2012 - 11.0.2100.60 (X64)
Feb 10 2012 19:39:15
Copyright (c) Microsoft Corporation
Express Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
 
lol
 
any one has answer
 
go to : properties/options/compatibility level
from your db
Check that the database compatibility level is set to :
SQL Server 2012 (110)
 
2:32 PM
it is work now
 
TRY_CONVERT will work now
 
yes
thank you alot
 
So , you get an answer
 
yes
thank you man
 
Good luck ;)
@Shaneis You love me?
 
2:34 PM
@Sami da-what @Sami?
 
No?
 
for helping that guy out?
 
You love me or not? just answer the question honestly
 
I like you as much as I like anyone here, if that helps?
 
:(
hahaha
 
2:36 PM
ha you got a strange sense of humour @Sami, but you're alright
 
hahaha
Just I'm in love
 
that's nice
 
2 hours ago, by Sami
My love SQL server
Yeah
 
@Sami Any particular version or just all of them?
 
All all all I love them all hahaha
 
2:39 PM
cool (Y)
 
I like what you write btw
I like SQL Server.I don't understand all of it, but I like it!
I love it
\o/
 
haha yeah well it's a nice feeling knowing that there is more to learn
 
Yeah , there is always more to learn
 
@IbrahimAlsurkhi hey @IbrahimAlsurkhi, fight and wail against this, or else you are going to be forever stuck with these kind of questions... just saying
 
^ (Y)
 
2:51 PM
I want to upgrade MariaDB 10.1 to 10.2.5 on CentOS7, anyone who can assist with this? (default way doesnt do it) (kinda a sql question, right?)
 
@Jeffrey absolutely kind of a SQL question but I don't know MariaDB or CentOS7 either. Sorry @Jeffrey
 
3:09 PM
ah, great! I found the problem :) (yum repo excluded mariadb* due to DirectAdmin)
 
@Jeffrey yup...eh...hate when that happens :|
 
^^ now at least I can use "with recursive......" in mariadb10.2.2!
 
@Jeffrey haha got a link? I want to see if it's like CTEs in SQL Server
 
it is exactly that!
 
@Jeffrey ah sweet! Welcome to 2012 then! :P
on a serious note, congrats!
 
3:12 PM
@sha
 
you answered your own question, few do that
 
@Shaneis Yeah, that while mariadb is the first for php services to do that :S
gtg! thanks for the moral support!
 
3:48 PM
Bye guys!
 
see you @CrashBandicoot
 
4:22 PM
heading off, talk to ya tomorrow guys
 
@Shaneis Cya.
 
04:00 - 14:0014:00 - 17:00

« first day (1830 days earlier)      last day (2488 days later) »