noob sql questions

Message Bookmarked
Bookmark Removed
Not all messages are displayed: show all messages (22 of them)

sorry that should say @loginPassword not @employeePassword but you get the idea

someone who is ranked fairly highly in an army of poo (Colonel Poo), Tuesday, 25 August 2009 20:40 (fourteen years ago) link

lol @ new board description. was it that dumb of a question

i dunno i thought sql had a problem with accepting null for datetime
http://www.c-sharpcorner.com/UploadFile/sd_patel/EnterNullValuesForDateTime11222005015742AM/EnterNullValuesForDateTime.aspx
http://geekswithblogs.net/TimH/archive/2006/11/08/96546.aspx

( ´_ゝ˙) (Dr. Phil), Monday, 31 August 2009 14:16 (fourteen years ago) link

Also what happens if 2 employees by coincidence have the same password?

This is kind of critical; you need to use the employee's unique login ID if you want to make sure that one person isn't logging off multiple olther employees because they coincidentally have the same password.

I have a set of penises leftover from some bach party somewhere (HI DERE), Monday, 31 August 2009 14:20 (fourteen years ago) link

i dunno i thought sql had a problem with accepting null for datetime
Looking at those links it looks like some .NET bug, there is no problem setting datetime to null in T-SQL that I've ever come across.

someone who is ranked fairly highly in an army of poo (Colonel Poo), Monday, 31 August 2009 15:46 (fourteen years ago) link

lol @ new board description. was it that dumb of a question

haha no i just liked the way it sounded

mince lice (electricsound), Tuesday, 1 September 2009 06:07 (fourteen years ago) link

While we're at it, I have an SQL question, specifically SQL Server:

Is there any underneath-the-surface difference in what SQL Server actually does between the following 2 statements:

-- 1)

update p
set x = d.x
from p
inner join d
on p.id = d.id

-- 2)

update p
set x = d.x
from d
where p.id = d.id

??

I reckon functionally it's the same thing, but we have a consultant who insists the 2nd form is more efficient, that SQL Server does something different behind the scenes. Trouble is our not-really-enforced SQL coding standard requires we always use the 1st example (and I think that's the ANSI way anyway).

Any expert users on ILX who can shed light on this?

someone who is ranked fairly highly in an army of poo (Colonel Poo), Tuesday, 1 September 2009 14:20 (fourteen years ago) link

My understanding is that they generate the same query plan; however, I'm no SQL Server guru.

a fact-checker with The New Yorker magazine (HI DERE), Tuesday, 1 September 2009 14:23 (fourteen years ago) link

That is my understanding also. This guy generally knows his stuff, but I think he's wrong on this one.

someone who is ranked fairly highly in an army of poo (Colonel Poo), Tuesday, 1 September 2009 14:25 (fourteen years ago) link

http://lists.evolt.org/archive/Week-of-Mon-20050829/175368.html

At least in SQL 2000, they were supposed to resolve to the same query plan.

a fact-checker with The New Yorker magazine (HI DERE), Tuesday, 1 September 2009 14:38 (fourteen years ago) link

as an intermediate noob i would only use 1. the "more efficient" thing sounds bogus

am0n, Tuesday, 1 September 2009 14:42 (fourteen years ago) link

We're on SQL Server 2005 but I can't imagine it's any different there.

someone who is ranked fairly highly in an army of poo (Colonel Poo), Tuesday, 1 September 2009 14:44 (fourteen years ago) link

I got my thing to work ^________^

batch file

echo off
Set objShell = CreateObject("Wscript.Shell")
Echo Please enter password and press return
Set /p var1=
osql -d AFW3 -U sa -P password -S TESTSERVER -q "Exec EmployeePasswordLogout @LoginPassword=%var1%"

sql stored proc

CREATE PROC EmployeePasswordLogout (@LoginPassword varchar (10))
As
Update tblEmployee
set LoginDateTime = null
where @LoginPassword = LoginPassword
GO

bnw, Wednesday, 9 September 2009 16:18 (fourteen years ago) link

Dude seriously

Also what happens if 2 employees by coincidence have the same password?

Colonel Poo, Wednesday, 9 September 2009 20:27 (fourteen years ago) link

Being logged out while you are still using the database is only a problem if you were to try to enter it again which is pretty rare. But it probably isn't too hard to get username in there too.

bnw, Wednesday, 9 September 2009 21:10 (fourteen years ago) link


You must be logged in to post. Please either login here, or if you are not registered, you may register here.