« first day (1866 days earlier)      last day (2452 days later) » 

12:12 AM
Is it possible to have a default/expression to update set row every time it is accessed?
IE, 'ON ACCESS CURRENT_TIMESTAMP'
 
 
5 hours later…
user7912927
4:51 AM
gm guys (:
 
5:23 AM
hello and good morning
 
user7912927
@AdiMohan where do you work?
 
Production company on the technical department
how'bout you?
 
user7912927
6:00 AM
production company on the s/w dept
 
user7912927
alter database [<dbname>] set FILESTREAM(NON_TRANSACTED_ACCESS = OFF )
 
user7912927
Syntax error near Filestream on the above query? i couldnt find whats the problem here :( can anyone help me?
 
7:37 AM
morning guys
 
War
7:52 AM
morning
 
hi @War
 
anyone here experts with hashbytes in sql server?
 
8:09 AM
Morning guys
 
hey @Shaneis
 
War
@WhatsThePoint some context would help i think :)
A code sample perhaps?
 
using the hashbytes function to store passwords in the database using the 'SHA2_512' algorithm, the way we are encrypting them is by hashing the password, then adding the salt, then hashing again, but my login if statement code is always returning incorrect password, i suspect that it could be an issue with different types its returning or the way the original hash is passed into the stored proc, ill create a sample in sqlfiddle now
 
Good morning guys!
 
8:25 AM
hey @Sami, @AndyK
 
hey @Shaneis o/
 
good mornin' guys
 
user7912927
@Shaneis I generated a script of a database in SSMS. When i tried to open in Sql server Studio, it's saying "not enough memory to perform this operation"
 
user7912927
i cant open it.
 
user7912927
what shall i do here ? @Shaneis @AndyK@War
 
8:29 AM
o/ @Sami
 
if it is a java application maybe you could give it more memory :)
@Nias
 
hey @AndyK o/
 
user7912927
@Mofty its not
 
how big is the script/database?
 
user7912927
@Shaneis 6.39 gb
 
8:31 AM
And how much space have you given SQL Server?
 
user7912927
oops...how to check that? @Shaneis
 
War
@Nias download more ram
 
user7912927
@War 8 GB ram is there
 
in ssms, connect to your server then right click the server name and go to properties. In the memory page, there should be values there for Min server memory and max server memory
 
War
@Nias how much is actually free on the server?
 
user7912927
8:35 AM
under server memory option : min m/y : 0 , max m/y: 2147483647 MB
 
War
and what are you trying to do that's taking a lot of ram?
that implies only 2GB
are you sure all the ram is working and fitted correctly?
 
user7912927
under other memory options, min m/y per query : 1024
 
user7912927
@War its more than 2 GB....
 
user7912927
@Shaneis how can i open that query ?
 
@War hey do you have a suggestion to this issue : Filling multiple textboxes based on the selection of a suggested append in one textbox? (sql table is involved)
 
War
8:40 AM
@AdiMohan i'd need a code sample and a lot more context to understand that question
 
@Nias what happens if you just right click the file and click edit?
 
War
@Nias show us the query ... maybe there's something odd about it
 
user7912927
@Shaneis when i did that , its shows "file is too large for notepad,use another editor"
 
can i not make stored procs on sql fiddle?
 
user7912927
@War i cant open it bro...
 
8:43 AM
How did you make it?
 
@War so, if you have a textbox and want to add a autocomplete to it something like :
var myConnection = new SqlConnection(Constants.SQL_CONNECTION_STRING);
            myConnection.Open();
            AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection();
            string query = @"SELECT DISTINCT [ID]  FROM [db_owner].[MyTable]";
            SqlCommand cmd = new SqlCommand(query, myConnection);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.HasRows == true)
 
user7912927
@Shaneis i generated the script by,right clicking on the database,generating script by "schema and data" option
 
@Nias okay...so I guess now we have to go back to why?
 
user7912927
@Shaneis yeah :) why.......................................
 
@War and based on your selection, you should be able to fill other textboxes with the corresponding information of that particular row. but I don't think i can use a class and a list for something like this (i mean I've tried but didn't work)
 
8:45 AM
@Nias No, I mean why do you want to create a script of the schema and data?
 
user7912927
@Shaneis i am doing this method instead of backup and restore. BAckup and restore cant be done coz databases in 2 servers are of different versions...so i generated script and to execute on other server
 
War
@AdiMohan sounds like a combination of controls or just a simple editable grid.
A drop down that rebuilds a form from your selection might work too
 
it's just a autofill in more textboxes based on the selection of a parent textbox
and the data is retrieved from an sql table
 
user7912927
NTP-228 server (2008 version) , NTP-128 (2012 version) so its not possible to restore the backup file of ntp-128 in ntp-228
 
user7912927
@Shaneis
 
War
8:49 AM
@Nias if it's that big you have a problem ... Are you sure its not a sproc in something like sqlclr (in such a case it would be embedded in to a dll sense note pad would freak out.
@AdiMohan sounds pretty simple ... Not sure I understand what your issue is exactly though
 
@Nias It's not? I didn't think that would be a problem
 
user7912927
@War yeah...its too large that it cant opened anywhere
 
War
@Nias script the schema then do cross db query turning on ident inserts
 
user7912927
@Shaneis yeah..it cant be done coz of different SQL versions
 
@Nias you get an error message and everything?
 
War
8:52 AM
Separate data from queries that will avoid this problem
It's prob because you have about 2gb or more of data in the source db
 
@War yeah, I'd say you're right there @War
 
War
You would be better of scripting the db schema and then doing export import than trying to script the whole lot
You could also use something like SQL replication to handle the data pushing
 
user7912927
let me check that :)
 
if i send you guys an sql fiddle link would you be able to see my code in it?
 
War
Or build out an etl process in ssis
 
8:54 AM
@WhatsThePoint yeah probably
 
War
@WhatsThePoint don't ask to ask, just ask
 
@War but if I ask to ask to ask...then does asking the asker of the ask...ask ask ask ask...I need coffee
 
heres my fiddle link sqlfiddle.com/#!6/7743c/5 in reference to the hasbytes from earlier
 
War
@Shaneis Are you asking or just asking if youre asking about asking?
 
@War I'm not joking, I confused myself with that last comment. I don't even know anymore :|
 
War
8:59 AM
COFFEE !!!
 
ALL THE COFFEE!!
 
War
@WhatsThePoint to gen the password you'd likely need to do that in multiple statements surely?
 
@War wait, you're hashing to varbinary, then added a uniqueidentifier and hashing that?
I'm not really surprised that it can't work out what the original password is!
 
yes im doing that, missed it out on the fiddle though oops
fiddle updated
 
War
@Shaneis not me mate ... @WhatsThePoint
but yeh it feels a bit overkill imo
tbh though ... having SQL do this feels wrong to me ... it should be a pluggable provider model thing in the code on top of the db
 
9:08 AM
what we have in place is on our website we hash it once and then pass it over to the database, and add the salt and hash again
its so we arent passing plaintext password over
 
9:25 AM
@Shaneis Thanks again for your help yesterday mate - got it incorporated into my powershell server checks and works perfectly - will now save me a good bit of time each morning not having to expand all those steps....
 
sweet as @Ricky!
tbh you had my respect the moment you started automating the boring bits away :)
fair play!
 
powershell is addictive...makes you want to start automating everything
 
@Ricky I know, I'm indulging/fighting it everyday now
 
the only annoying thing is older servers that are running older versions of powershell that don't have some of the functions
 
I'd say that's a good thing though, you'll probably know more about PoSH that way
all the workarounds and what nots
 
9:43 AM
yeah that is true
 
one of the 'consultant' wrote that ...
consult is the concatenation of the word con and insult
 
whether to use union or join for searching multiple tables and then combining the results into one ?
 
@AbhiBurk both. that thing was supposed to be a view ...
 
9:59 AM
@AndyK No.
 
@Shaneis no about?
 
whatever "query" that was that the consultant sent you. = No.
Just tell him "No."
>:(
 
@Shaneis we agree it is shit
no comment, no nothing
 
@AndyK I think "No." is all I can manage right now...
@AndyK agreed
 
i cant find out what is exactly my solution
shud i used both of them together ?
 
10:15 AM
@AbhiBurk maybe? I have no idea what your problem is though...
 
10:30 AM
:37834102

Some good info: codeproject.com/Articles/1068500/…


Especially - In order to union two tables, there are a couple of requirements:

    The number of columns must be the same for both select statements.
    The columns, in order, must be of the same data type.
one day I'll get the hang of formatting...
 
@Ricky meh ef!
I just code with Ctrl + K and that's all
 
yeah it formatted it for me when I didn't require it :-p
 
@Ricky bahaha
 
user7912927
11:19 AM
@Shaneis @War spended abt 2 hours to generate seperate scripts for scheme and data..got the script for schema..but for data it shows error. I still have have the 6 gb script of schema n data. how can i open it? :(
 
War
@Nias how big is the schema only one ?
 
user7912927
@War 6mb :)
 
user7912927
schema for all tables,sp and fnctions
 
War
That feels reasonable
so that, when you run it ... does it work?
do you get a new empty db with all the tables and sprocs ect in it?
 
user7912927
it would work..but i need datas too @War
 
War
11:25 AM
one step at a time
first you need a db to put the data in to
then you migrate the data
 
user7912927
how to put the data into?
 
user7912927
both databases are in diferent servers
 
War
are both servers MS SQL ?
 
user7912927
yeah
 
War
and are they on the same LAN ?
 
user7912927
11:27 AM
yeah,...one server is 2012 version and other 2008
 
War
perfect
 
user7912927
data is on 2012
 
War
ok so on one of the servers (doesn't matter which, add the other server as a linked server
 
user7912927
i need to move it to database in 2008...just like bakup and restore
 
War
run the script on the 2008 one to create the db
 
user7912927
11:28 AM
first let me run the script for schemas?
 
War
yeh
 
user7912927
on 228
 
user7912927
i mean 2008 version server
 
War
so you should have ...
2012 server (with currently full db)
2008 server (with new empty db)
 
user7912927
yeah
 
War
11:29 AM
great
so
what you need to do is something like ...
create the link
so pick a server (doesn't matter which)
go to SSMS and connect to both servers then add a new linked server from one to the other
what this does is allows you to run queries across them
for example ....
insert into Server2.MyDB.dbo.Table1
select * from MyDb.dbo.Table1
see how it works?
you'll have to look at the relationships
and for tables with pk's you'll have turn on ident inserts
^ enable identity insert first on the 2008 table
then do as above
that will tell SQL to literally stream everything from the table on 2012 in to the same table on 2008
it'll even keep the keys the same for you
start simple with a table thats not related to anything or only has many to many type refs
those will be the easiest to push
 
user7912927
how to add a linked server from one to the other?
 
War
the other way you might get away with is to do a back and restore but that menas you may have set the compat level first
I think you ruled that one out though
9
Q: How to create the linked server for SQL Server 2008 where we have the database from 2000 and 2005

Vikrant MoreCurrently I am working on SQL Server 2000,2005 & 2008, my requirement is like, the database available in SQL Server 2000 & 2005 will be available in 2008 using a linked server. Let's say I have a database in SQL Server 2000 called LIVE_2000 and in SQL Server 2005 it's called LIVE_2005, can someo...

 
user7912927
if i set the compat level, will it be possible to restore a 2012 backup file in 2008 server?
 
War
should be
 
@Nias No, you can't restore down
sorry @War
 
War
11:37 AM
can you not ?
 
I've been bitten by that
 
War
dam :(
 
yeah, tell me about it
 
War
I thought that was the whole point of the compat level
sheesh MS
well done!!!
 
huh, just got hit up by a recruiter in Linkedin
 
War
11:38 AM
anything good?
or just spam
 
Hi guys! I am trying to extract my date into variable with Date format in Postgres. Getting this error "date/time field value out of range: \"1498544910546.57\"", why?
 
@War yeah doesn't look half bad actually, closer to home, more pay, Senior position though, and I'm technically a Junior now
 
War
@Shaneis oh cool :)
 
Hi all
 
12:00 PM
@Alex Hi , Eid mubarak
 
Hey Sami
 
hey @Alex
 
Eid Fitr Mubarak
Hey Shaneis
Anything exciting happen since Friday? Was out sick yesterday
 
happy return @Alex
 
Thanks, Andy
 
user7912927
12:16 PM
@War i linked the servers..but i ddnt find any option to link databases and move data from 2012 server to 2008. how can ii move it?
 
@Nias he gave you the code already @Nias :)
 
War
@Nias you don't link databases
now you just run a cross server query
As I stated above ...
50 mins ago, by War
insert into Server2.MyDB.dbo.Table1
select * from MyDb.dbo.Table1
see how it works?
even if you have 100 tables to script that out would be fairly small
 
I would need some code reviews
SQL code reviews
who should I ask to e.g is there a website where I can do that?
 
@AndyK there a code review on SO
you can also just gist it and show here if you want
 
12:29 PM
yep, so Code Review is here
Best o'luck!
:(
 
user7912927
12:40 PM
@war okay. But , How to move all the tables to the other server?
 
user7912927
i also need to move the sp,datas in it,fucntions views everything on my local server
 
War
dude c'mon
we are going round in circles here
you have your two db's
all that's left is copying the data
surely you can write simple select and insert statements
 
user7912927
do i need to specify the table formats?
 
War
do you or do you not have two db's (one on each server) ?
 
user7912927
yeah
 
user7912927
12:44 PM
i have
 
War
so you have the table formats
 
user7912927
one on each server
 
War
both those db's should be the same right?
 
user7912927
but there are 300 somthn tables
 
War
same tables, same sprocs
i'm trying to show you in baby steps how this can be done
 
user7912927
12:45 PM
@War yeah..they should be same
 
user7912927
okay
 
War
you're trying to figure out 10 steps ahead of where you are which won't make sense unless you understand what's involved
once you get the process there are ways we can speed this up
did you add the linked server?
 
user7912927
okay :)
 
user7912927
yeah...
 
War
ok so in SSMS connect to one of the servers (preferrably the one that shows the linked server)
 
user7912927
12:47 PM
okay..thats on local server
 
War
so dead simple ...
to get all the data from a table in the db on your local server you do something like this ...
select * from Db.schema.tableName
make sense?
 
user7912927
tablename?
 
War
seriously?
have you ever done a simple select query on a table before ?
 
user7912927
lol........so u saying that i should individually add each tables?
 
user7912927
select * from Db.schema.tableName .. ?
 
War
12:50 PM
no i'm saying stop trying to second guess me and follow what i'm saying
 
user7912927
okay
 
War
trust me this isn't hard once you understand all the parts you need
 
user7912927
okayyyy...
 
War
I'm trying to give you the parts
 
user7912927
sure :)
 
War
12:51 PM
then we can put them together
so
 
user7912927
ohh..yeah
 
War
lets call them ... local and destination (i have no idea what you called your linked server)
 
user7912927
okay
 
War
for arguments sake lets say you have a db call Foo with a table called Bar
if I want all data from Bar I write ...
select * from Foo.dbo.Bar
that would select everything out of the local copy
 
user7912927
i know that bro
 
War
12:53 PM
but if I want to get everything from the linked server copy of the same table I would do something like ...
select * from Server2.Foo.dbo.Bar
 
user7912927
okay
 
user7912927
for 100 tables?
 
War
bear with me
 
user7912927
lol..okay
 
War
now say I want to insert everything in bar from local in to bar on server2
insert into Server2.Foo.dbo.Bar
select * from Foo.dbo.Bar
now because tables have complex things like pk's
 
user7912927
12:55 PM
okay
 
War
we need to turn on ident inserts
 
user7912927
hmm.
 
War
SET IDENTITY_INSERT ON Server2.Foo.dbo.Bar <-- turns on ident insert for our target table
 
user7912927
okay
 
War
SET IDENTITY_INSERT ON Server2.Foo.dbo.Bar
insert into Server2.Foo.dbo.Bar
select * from Foo.dbo.Bar
SET IDENTITY_INSERT OFF Server2.Foo.dbo.Bar
will copy EXACTLY
the contents of that table
 
user7912927
12:56 PM
okay
 
War
forcing PK's to be identical to your local copy
these statements need to be done in a batch together
and you can only turn on ident for one table at a time (I think)
there may be a way to do this for more tables but i'm not sure)
so the next piece of key info you need is that because you have 300 tables you need to write this out 300 times (which would suck)
so ... we can write a statement that writes all the 300 batches for us
 
user7912927
yeah
 
War
so query the schema and from that generate sql for each table in the db
the one issue that leaves is the order of those statements
due to the dependency graph that could take you a while to sort out
essentially you wnat something like ...
SELECT * FROM sysobjects WHERE xtype='U'
that will get you the list of table names
you may want to extend that if you are using schemas
 
user7912927
ok
 
user7912927
'
 
user7912927
1:01 PM
yeah
 
War
if you concat fields together you can build your statements from above
then use docs.microsoft.com/en-us/sql/relational-databases/… to execute your batch of statements
this is basically what common ORM's like EF do
and if you wrap that in a transaction you can be sure the lot either goes over or none does
you see where I am going with this ?
 
user7912927
yeah
 
user7912927
:D
 
War
happier now?
 
user7912927
big task..i guess...i need to check that now
 
War
1:04 PM
it's not going to be easy for sure
 
user7912927
yeah
 
user7912927
-_-
 
War
but each piece (do it slowly and in stages) if you keep the resutls and figure out how it all fits you should be able to gen a script that does this
but key point here TAKE YOUR TIME
small pieces
 
user7912927
yeah :)
 
user7912927
okay bro..thanks for sparing me your valuable time
 
War
1:05 PM
@Shaneis @AndyK don't suppose you know of a way to order the scripted statement creations so we can make this work do you ?
 
user7912927
i will check that now..will let u know soon ;) @War
 
@War sorry I stopped listening, what?
oh good one! Yes, TAKE YOUR TIME!!!
 
War
@Shaneis trying to script a db copy (between servers)
 
@War yeah, I'm still not sure why you don't restore a backup... :|
Not saying it to be flippiant
but I don't see why it doesn't work and it would save SO much hassle
 
War
@Shaneis the destination is an older version of SQL for some odd reason
 
1:09 PM
Oh, he's moving it backwards?
I didn't realise that!!!
shit
 
War
yeh lol
 
tbh everything you said I would do, it'd take time to work out the final scripts but it's the only thing I can think of
...
 
War
personally ... if it were me I would just upgrade the SQL instance on the destination server
 
how far back? 2012 - 2005?
 
War
@Ricky 2012 to 2008
 
1:11 PM
we did a code review with the dev
 
War
huh?
 
@War we did a code review with the dev who wrote the SQL
getting better now
I finally understand his logic now
 
War
ah nice ... logic ... in SQL ?
oh dear
 
@War there are a few in term of CTE
 
War
heavy ... i'm not a fan of CTE's ... but they do help solve some epic complexity :)
sounds like you're getting deep in to the workings of it though :)
 
1:23 PM
CTE's saved me with some PIVOT stuff
 
@War 5 CTEs. I'm not sure if that many are needed tbh
but in term of sorting and reporting, it does not need very strong performance
 
War
1:51 PM
wow that's a lot of CTE's
 
@War there are quite a lot of sortings
 
War
Sounds like you're getting some help with this architectural nightmare you have to solve
are you getting any luck from the office connections / replication side yet?
 
 
1 hour later…
3:03 PM
@War yeah. I've asked for some providers for replication
let's see how it goes
 
3:32 PM
heading off guys, talk to you tomorrow
 
3:49 PM
See ya, Shaneis
 
War
4:31 PM
soz guys had to run for a bit (emergency health scare) ... back now
@AndyK providers ... can't this dba dude you are talking to today help with it?
it sounds like classic SQL replication stuff
 
 
5 hours later…
9:33 PM
Hi guys, been off for a while
@ARr0w Eid Mubarak! Sorry for being late...
 
@CrashBandicoot Eid mubarak
 
@Sami Eid Mubarak!
Hope you had an amazing Eid!
 
thnx
 
No problem
 
some of
Hey @Alex you 'r free for 5 min?
need some information
^ I don't have access to the second one
@CrashBandicoot You'r a student?
Or you have a job?
 

« first day (1866 days earlier)      last day (2452 days later) »