all groups > sql server programming > january 2007 > threads for friday january 26
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
SQL Server equivalent of the VB Choose() statement
Posted by Rico at 1/26/2007 10:30:08 PM
Is there an SQL equivalent of a CHOOSE statement in Visual Basic? The
CHOOSE statement in vb would do something similar to the following;
CHOOSE(NumbericArgument, ReturnIfArg=1 , ReturnIfArg=2 , ReturnIfArg=3..etc)
Example
CHOOSE(Datepart(dw,GETDAT()),"Monday","Tuesday","Wednesday" etc...)... more >>
Boolean comparing two fields in a View
Posted by Rico at 1/26/2007 10:09:47 PM
Hello,
I'm trying to compare two fields in view and return a bit / boolean. Is
there a better way to do this than using a CASE statement?
Thanks!
Rick
... more >>
Update bad addresses
Posted by Chris at 1/26/2007 4:23:40 PM
I got got a pile of bad email addresses to update in our SQL database.
I know how to do this for individual records using the update command.
Is there a way to execute an update using the list of addresses in an
excel spreadsheet or some other form of list? This kind of scripting
is new territo... more >>
How to check if an ID is included in a grouped table that counts the same id
Posted by dhobbs NO[at]SPAM studyguidesystems.com at 1/26/2007 3:35:12 PM
I am trying to figure out how to do a check to see if a specific ID
exists when I do a grouped query that counts the same ID.
Confusing...you got it. Here is some more details which I have
simplified.
I have three tables and included the fields in parenthesis.
Members (MemberID, FirstName, L... more >>
SS 2005 system db migration
Posted by CLM at 1/26/2007 3:27:02 PM
I have googled, looked in BOL and can't find the MS document that explains
how to migrate msdb and master from 2000 to 2005. I would guess that you can
script the logins for master. And I know that the DTS packages in msdb can
be problematic. But still - isn't there a document that explains... more >>
Calling same StoredProc having update statments by multiple java Prog.
Posted by vipindwivedi2 NO[at]SPAM gmail.com at 1/26/2007 2:24:47 PM
Hi,
Is it safe and fast to call the same Strored proc with update
Statements in it, by different Java prog.
It will not degrade performance or through exception?
The TABLE_NAME and values are passed as argument to proc.so table will
be always different.
No two prog OR threds will update the... more >>
orphans users
Posted by JFB at 1/26/2007 1:12:09 PM
Hi All,
I'm transfering data from sql2000 to sql 2005 using backup and restore
method.
After restore the data my users doesn't show in sql2005. How can I fix this
issue?
In 2000 I used this
http://vyaskn.tripod.com/troubleshooting_orphan_users.htm
Tks
JFB
... more >>
Function Parameter "bitwise?"
Posted by Marco at 1/26/2007 12:46:04 PM
I need to create a function but my situation is a kind of hard to explain, so
I will use the Pubs DB as example.
Let’s say I need a function to return the sales quantity based in the
storeid and the payterm.
I can create a function like the below, it works if a need just *one* kind
of... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
SQL Server 2000/2005 Query Processor Bug
Posted by John at 1/26/2007 12:30:40 PM
in the AdventureWorks database try these queries
-- this causes an error
select ProductID from Person.Address
go
--BUG: this does not ( entire product table is returned)
select *
from Production.Product
where ProductID in (select ProductID from Person.Address)
go
-- this causes an ... more >>
Create table via query in SQL Server 2005
Posted by Sean at 1/26/2007 12:16:01 PM
Knowing the ID in ProductTypes table (ProductTypes.ID = A2); how do I create
table MyNewTable and data to it from ProductTypes, Products and ProductValues
tables? I am using SQl Server 2005.
ProductTypes:
ID Type ProdDesc
A1 bk Books
A2 sw Software
A3 hw Hardware
Products:... more >>
Commit Transaction in Middle of Script?
Posted by lucius at 1/26/2007 12:12:26 PM
I have a long-running TSQL script in SQL Server 2000. It does a select
and about 40 SQL-Updates on every row in a 40,000-row table. I think
everything is happening in the same Transation context. Is there a way
to force a "Go" or "Commit Everything" in the script to make sure
everything is flush... more >>
Data missing after timeout even though COMMIT has been caled prior to timeout
Posted by Scott Cupstid at 1/26/2007 11:58:47 AM
We are working on a VB.NET application using SQLClient command objects to
post data to the underlying SQL Server 2000 database. The application is
deployed in a multi-user environment with no more than 10 user accessing the
database at any given time. The host server is supporting approximate... more >>
where can I get some cool code type questions for c#, asp.net and SQL
Posted by Mark C at 1/26/2007 11:57:54 AM
I am looking for questions and answers in the form of code. In other
words a question would show a bunch of code and then you would have to
figure out the result
I am trying to get some content for my community based web site
Thanks
--------------------------------------------------... more >>
query and compare dates
Posted by Frank at 1/26/2007 11:26:01 AM
Hi all.
I've got a table in which a field (called dateadded) is filled using
getdate() as default value. When reading this date it shows as e.g.
'2007-1-26 20:19:34'. If I use this value in a query using 'Where dateadded
= ...' I get nothing. As far as I can tell it's because of the millisec... more >>
Queries views parameters
Posted by Robert Bravery at 1/26/2007 11:19:48 AM
HI all,
I have two views, one view does a select opendatasourse to open a excel file
I then have a SP, that amongst otherthings does a select into ont eh
resultant rowset of a join of the two views.
The excel file name at this point could be unknown, so I need to pass it in
as a parameter... more >>
JOIN query
Posted by Hitesh at 1/26/2007 11:07:25 AM
Hi,
I have join question..
let's say I have two tables
Create table #Tbltemp1
(AcntId varchar (20), AddB int)
Create table #Tbltemp2
(AcntId varchar (20), RemoveB int)
insert into #Tbltemp1 values ('RT1', '10')
insert into #Tbltemp1 values ('RT2', '20')
insert into #Tbltemp1 val... more >>
Why doesn't sp_Depends show correct dependancies upon a database restore to a new server
Posted by Jason Chapman at 1/26/2007 10:55:41 AM
I have recently restored a database from one MS SQL Server 2005 to another,
and noticed that dependency information (sp_depends) is not showing
dependencies for any of the Views/SP/UDF/triggers etc.... on the restored
server/database (However all the dependancies show up on the original
serv... more >>
Reading value of a Windows variable in a SQL script?
Posted by maxshop at 1/26/2007 10:50:32 AM
MS SQL Server 2000
Hello Everyone,
I am executing a SQL script from a Windows batch program using
isqlw.exe as:
rem - test.bat
set SCRIPTS=C:\Scripts
set TMP=C:\Temp
isqlw.exe -S dbserver -E -i %SCRIPTS%\test.sql -o %TMP%\test.tmp -FA
Is it possible to read the value of the SCRIPTS o... more >>
Problem with SQL syntax!
Posted by Bill Nguyen at 1/26/2007 10:37:52 AM
I'm running into a weird problem:
The following statements are identical but one is not working:
SELECT TerminalID
,TerminalName
FROM WF_Terminal A
where a.terminalid NOT IN (
select b.terminalID from mp_mapInfo_tanklink B
WHERE b.tankID = '1111111-1' )
This runs great, I got... more >>
How can I find out what command sp_execute is running (without using Profiler)
Posted by pshroads NO[at]SPAM gmail.com at 1/26/2007 10:22:19 AM
I have a 3rd party application whose new version makes SQL calls with
sp_execute. Previous versions have just made direct calls to SQL
Server. When we are having blocking or other performance problems I've
used fn_get_sql to find out what command is executing but fn_get_sql
doesn't appear to wor... more >>
Max and Min function give different result
Posted by culam at 1/26/2007 10:12:01 AM
My coworkers and I are going nut with this issue. When we used MIN function
to the query below, the result yielded 197 records. But if we used MAX
function, it yielded 199 records. We are expecting the result to be the
same, 199 records.
I looked up the two missing records and nothing ... more >>
Transact-SQL - Date Ranges
Posted by cb at 1/26/2007 9:31:00 AM
Hi,
Below is the code that I need to modify in order to produce the same results
but with a user entered BeginningDate and EndDate. The following is the proc
that needs to be modified
CREATE PROCEDURE [dbo].[usp_report_wfn]
(@in_MonthChar datetime,
@in_MonthcharBeginDate datetime,
@i... more >>
sysprocesses.status always return "sleeping"
Posted by BM at 1/26/2007 9:07:54 AM
Hi
With SQL Server 2000, I have created a profiler with DB_ID = x, every things
is ok and I can see running queries,
But if I query sysprocesses with query like this :
select sql_handle, spid, status, last_batch, waitresource
from master.dbo.sysprocesses with(nolock)
where DBID = x
The... more >>
How to BCP Table Into Seperate Worksheets in Excel
Posted by LaurenceRooks at 1/26/2007 8:39:02 AM
How do you BCP a table or set of tables into individual worksheets within an
Excel spreadsheet?
I know it's possible to do this via SSIS, but that's not an option since
this is part of a stored procedure used to export dynamic data. I'm using
SQL Server 2000 as the database engine but am u... more >>
Dynamic PIVOT for future realeases
Posted by Jim Bennett at 1/26/2007 8:26:01 AM
Does anyone know if Microsoft has plans to make the PIVOT 'IN()' clause
dynamic in future service packs or releases?
This just keeps bugging me!... more >>
Input Paramter as part of OPENDATASOURCE
Posted by mpprpp NO[at]SPAM yahoo.com at 1/26/2007 8:04:23 AM
I want to use an input parameter as my filename, but I get a synatax
error message. Howerve, when I hard code the filename the proc compiles
successfully.
Thanks for any help. I'm using SQL Server 2005
LTR_90,
LTI_ELIG_pct,
LTI_REC_pct,
LOW_SALARY,
HIGH_SALARY FROM OPENDATASOURCE(... more >>
database modeling help
Posted by rodchar at 1/26/2007 8:00:07 AM
hey all,
Given the following database model (4 tables in all)
Employees
---------
EmployeeID
FirstName
LastName
JobID
Job Positions
-------------
JobID
JobTitle
ManagerID
DepartmentID
Departments
-----------
DepartmentID
DepartmentName
ParentDepartmentID
ManagerID
Organiz... more >>
Problem
Posted by CLM at 1/26/2007 8:00:00 AM
I've posted this here and in Security w/o a response, so maybe my question is
confusing. But here's hoping:
I’ve got two servers, say ServerA and ServerB, that are Windows 2000 Adv'd
Server SP4 & Sql Server 2000 SP4 . We are going to have to go to a tighter
security enviroment where eac... more >>
Seeking TSQL logic optimization. Thank you.
Posted by Farmer at 1/26/2007 7:56:43 AM
Thank you for any suggestions.=20
Your help and time is really appreciated.
-- My requirements
=20
declare @IDlist nvarchar(500)
set @idlist =3D N'-16,0,1,20,10' -- I have a comma delimited list of =
values
declare @IsPositiveOperator tinyint -- This is an operator type =
ind... more >>
Temp tables not deleted when executing SP as pass-through SP in Ac
Posted by SXQ at 1/26/2007 7:41:02 AM
I have a SP in SQL Server 2000, I want to execute this SP as a pass-through
SP in MS Access.
In this SP, there are temporary tables which are dropped when they are not
needed. This works fine when I execute SP in SQL Query Analyzer. But when I
execute pass-through SP from Access, the tempor... more >>
SQL Server modify dbf file...
Posted by murrayb3024 NO[at]SPAM gmail.com at 1/26/2007 7:36:26 AM
We have an older app that uses a dbf file from foxpro. We are trying
to automate a process of wiping the table and then moving data from one
of our SQL tables into the dbf. Currently for testing we have the dbf
on the test server. We created a odbc with the foxpro driver. I am
using a DTS pa... more >>
dos script
Posted by Kevin at 1/26/2007 6:32:01 AM
hi,
I know this might not be related to sql, but I wonder if any smart people
out there know how can I return "hello world" to the screen.
I have a file "test.cmd" which contains following code, but when I execute
it, I only get "hello" back. why is it not assigned?
@echo off
set ... more >>
Matching multiple columns
Posted by NathanG at 1/26/2007 6:16:01 AM
Hi,
I need to match data held within two tables but the format of the data is
different. here some exmaple data
Table: organisation Table: Export
Parent Child Alias ZOF
Z_Executive
MAN ... more >>
declaring cursor slow under windows XP
Posted by Claudia.Hakvoort NO[at]SPAM directbox.com at 1/26/2007 6:08:02 AM
Hello everyone.
We have an application running under different os' (windows NT, 2000,
XP, 2003) connecting to different databases (db2, informix, oracle,
pervasive, mssql) via odbc.
Everything fine - except the combination windows XP with SQL Server
2005 Developer edition.
It works, but ever... more >>
Paging records on SQL 2000 : Followup question
Posted by rbg at 1/26/2007 5:56:21 AM
You are right, I did not include the exact query since it has a whole
of joins and many where clauses in it.
I did not want to make the post very hard to read, hence I simplified
it.
In the Stored proc I am using a String variable @SQLString
varchar(2000) to hold the entire select statement, ... more >>
full model transaction log recovery question
Posted by bringmewater NO[at]SPAM gmail.com at 1/26/2007 5:29:36 AM
Using full model transaction logs in SQL 2000 how do they work in the
following scenario:
I do backups every day but the backup fails on Monday and Tuesday, but
at 10 am on Wednesday I accidently deleted records from a table.
My understanding is that truncate would not have occured to the fu... more >>
Conversion to ANSI standard outer join
Posted by Paul Ross at 1/26/2007 3:04:01 AM
Hi
We have a load of code in SQL 2000 & Sybase that uses the old style outer
joins (=* & *=). We would like to move to ANSI standard before migrating to
SQL 2005. There is just too much to be done by hand so I'm looking for a tool
to do it for us.
I have tried:
SwissSQL - didn't work
S... more >>
Changing Default Constraint
Posted by TC at 1/26/2007 1:39:32 AM
I read where you must drop the current default constraint, then add a new
one in order to change it.
This works fine if you know the constraint_name. I use the following code to
find the constraint_name, but when it comes time to drop it I get the error
:: Incorrect syntax near '@defname'
dec... more >>
Backup SQL2005 not valid
Posted by Pol NO[at]SPAM Comune at 1/26/2007 1:31:02 AM
Hi,
I'm using SQL server 2005 Standard Edition 64 bit on Intel Xeon Server
version 9.0.2153. I scheduled backup daily and thje bckupo process works fine
(terminate with success). But if i look at the Log file i find the message
that file is not valid as this:
Eseguito come utente: NT AUTHORI... more >>
Executing a Parameterized SP passing multiple values to the IN function.
Posted by Manny123 at 1/26/2007 1:00:15 AM
Hi there,
This is probably basic but I just don't know how to exec a SP passing
multiple values to an IN function.
having a parameter in a sp like @Test varchar(10)
on the Where clause there's the normal,
WHERE Product IN (@Test)
now, I want to execute this SP passing two or three v... more >>
FOR XML: How do I get from here to there?
Posted by Mark S. at 1/26/2007 12:41:28 AM
Hello,
Working on an pre-existing app that is using a XSL template that relies on
the following XML data structure (which the powers to be won't be changed.)
<filters>
<countries>
<criteria value="US" customCriteria="" />
<criteria value="JP" customCriteria="" />
</countries>... more >>
|