Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008
August 2008
all groups > sql server programming > october 2005 > threads for monday october 31

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

NOT IN....
Posted by JB at 10/31/2005 11:09:21 PM
Is it usual for a 'not in' statement to return no rows when the subquery has a null in it? Also, is this a distinction to the left outer join method? TIA ...more >>


Information Schema Query on linked server fails.
Posted by MLokhandwala at 10/31/2005 9:04:02 PM
Hi, We had a simple application which compared schemas on local servers. We are updating it to compare schemas across servers. Unfortunately the query which refers to the Information_Schema fails, and I cant find any syntax to make it work! Here is the simplified version of the query. SE...more >>

Update is taking too long
Posted by mamin123 NO[at]SPAM yahoo.com at 10/31/2005 7:29:51 PM
Hi, I am having issue with simple update statement: Statement is as follows: UPDATE tblProduct SET Quantity = Quantity - 1 WHERE ProductId= 'SG7271308' and Q_tag = 'YES'; tblproduct table has only 5000 rows and productid is PK. Above statement is run in loop. It times out in couple of it...more >>

"Bad variable type" error msg -- can't get past it.
Posted by JeremyGrand at 10/31/2005 5:29:33 PM
I posted this here a few days ago, and someone said to ask on a delphi forum. Well, I did, and also have searched everywhere I can imagine, without luck. My stored proc when executed from delphi 7 produces a Bad variable type error. This happens on win2k and win98, but does not happen on ...more >>

What is an update-in-place?
Posted by John Kotuby at 10/31/2005 5:01:36 PM
I have just read in Chapter 12 of the Microsoft SQL Server 2000 Performance Tuning Technical Reference by Microsoft Press that.. "an update-in-place is actually a delete operation immediately followed by an insert operation". This one sentence concerns me because we have just changed most of...more >>

Searching through separated list
Posted by tshad at 10/31/2005 4:11:56 PM
I have a set of tables that I have inherited that are fairly large and we are setting up some searches that entail pulling ID's out of a string. I know this is not the greatest set up (and not at all relational), but I do have to deal with this table. I have stripped down that table to jus...more >>

Unable to run sp_executesql
Posted by jainamber NO[at]SPAM gmail.com at 10/31/2005 3:45:43 PM
Hi, I am trying to use sp_executesql to check the existence of a user table at run time. I am using the sp_executesql stored procedure but getting the incorrect response. Can sp_executesql be used to change table names at run time. Do I have to use 'exec' to achieve my goal. If yes, how...more >>

Unable to use sp_executesql
Posted by jainamber NO[at]SPAM gmail.com at 10/31/2005 3:42:18 PM
Hi, I am trying to use sp_executesql to check the existence of a user table in run time. The t-sql code is as follows: *************************************************** DECLARE @SQLString NVARCHAR(500) DECLARE @ParmDefinition NVARCHAR(500) DECLARE @Exists int SET @SQLString...more >>



Creating a date range during runtime in SELECT
Posted by Ramez at 10/31/2005 3:32:01 PM
I have a bunch of rows similar to this ID, Name, eMail, SignupDate 1, John, john@nowhere.com, 2005-01-03 2, Mary, mary@nowhere.com, 2005-04-05 3, Mike, mike@nowhere.com, 2004-06-06 etc... Ok, now I have parameters called @StartMonth, @EndMonth, @YEAR I want to to select all the rows tha...more >>

if else with WHERE
Posted by Opa at 10/31/2005 3:31:10 PM
Hi, I'm trying to create a store proc and use a WHERE clause only if a certain condition is met. When I use the WHERE after an if condition, the sql enterprise tool tells me it's invalid. "Invalid syntax near WHERE clause" Here is my proc: CREATE PROCEDURE [dbo].GetContractorsList ...more >>

TSQL help - Case?
Posted by culam at 10/31/2005 2:52:03 PM
I got data in multiple records with the same ID, and I would like to rearrange it into 1 record per id. Please help, Thanks, Culam Issues --------- id work home alternative emergency ------------------------------------------------------------------...more >>

Intersection of N sets
Posted by Taras Tielkes at 10/31/2005 2:49:23 PM
Imagine a table that enumerates membership of items to some set: create table sets ( setId int not null, itemId int not null ); some data: set 1 = {1,3,5,7,9} set 2 = {1,2,3,4,5} set 3 = {4,5,6,7} translated to this model: setId, itemId 1,1 1,3 1,5 1,7 1,9 2,1 2,2 2,3 2...more >>

string parsing
Posted by Alien2_51 at 10/31/2005 2:31:03 PM
I have a code that I need to parse, there's got to be an easier way to approach this than the way I am... here's a sample pattern for the code.. V-930186-1-IRS1099 So I need the '930186' part.. The problem I'm having is I'd like to be able to reference the string part that I'm currently...more >>

If statements - I think
Posted by Art at 10/31/2005 2:28:03 PM
Hi, I'd like to output values into my table as follows: If column A of my input table equals 1, then I want 4 values in my output table: x,y,z,0 If column A of my input table equals 2, then I want this instead: x,y,0,z x, y, and z are columns in my input table. I don't know how to...more >>

Changing current database during local tx or xa tx
Posted by Taras Tielkes at 10/31/2005 2:25:43 PM
What are the consequences of changing the current database (using "use dbname") during a transaction? If I modify multiple databases (on the same Sql Server instance) during a transaction, will all changes be done in the same transaction (and commited/rollbacked atomically)? Does using X...more >>

Selecting the most recent date...
Posted by Mike Austin at 10/31/2005 2:06:02 PM
I have fact tables in a data mart where it is possible for the user to have rated a particular item on date X and then rated it again on date Y and again on Date Z. This is OK, as we need to perform analyses on these behaviors. However, for the more important analyses it is necessary to use o...more >>

Need help determining occurences of a specific value
Posted by Rick Shaw at 10/31/2005 1:42:35 PM
Hi. I need some help with my query. Below is a sample of a data from a table. What I need to accomplished is to get the TDates of the first occurence of 500 hours for each EmployeeID. So with the sample data below, I need to get in my query, Emp1, 2005-02-19 Emp2, 2005-02-25 TID...more >>

Assigning permissions to a table
Posted by stjulian at 10/31/2005 1:29:16 PM
I have a table that is being dropped and then recreated by "SELECT INTO" through a scheduled stored procedure. So, therefore, all permissions are being dropped as well. I need to re-establish SELECT privileges for this table to a role containing a user, or if it can't, a user alone. I have ...more >>

Restoring Tran. Log files
Posted by Eric at 10/31/2005 1:21:02 PM
I need to restore a database on my test server from that on my production server. Here's what i've done so far: 1) Created a new db on my testing server named 'main_test' 2) Restored 'main_test' using .bak file from my production db. Now, I have several transaction log files I wan to inc...more >>

query to detemine trigger status
Posted by Mohan at 10/31/2005 12:46:25 PM
I know how to retrieve the list of triggers in teh database. Select * from sysobjects where xtype = 'TR' What I want to know is how do i tell whether the trigger is disabled or enabled. I would appreciate if anybody can help me this. thanks MB ...more >>

nedd some help with datetime
Posted by Chris at 10/31/2005 11:59:06 AM
Hi, I am passing datetime from my vb.net app for storage in sql server like this Dim DT As DateTime = DateTime.Now Dim str As String str = DT.ToString("MMddyyyyHHmmss") ....insert to database str (example datetime 10312005135802) The table column datatype is cha...more >>

SQL system Procedure
Posted by Babu at 10/31/2005 11:58:25 AM
How can I alter the system procedure in MSDB database. I am not getting the alter window to modify SQL system procedures...more >>

User specific tables
Posted by Ben at 10/31/2005 11:57:53 AM
hello, I am working on a stored procedure to produce a report where the user will select categories to be placed on a report. Is it possible to create a storedprocedure that will create a user-specific table that will contain the categories and a column to indicate selected or not. I nee...more >>

xp_cmdshell and terminating a bad shell command
Posted by TdarTdar at 10/31/2005 11:55:26 AM
Hi, if i call from query analizer this command EXEC XP_CMDSHELL 'C:\SHIPINFO 492796' c:\shipinfo.bat = echo off e: cd\ cd dbman~1\dbman dbman "shipdjp.run with %1" type c:\shipfile.txt .... The problem is something happens not sure what at the moment but the process will ...more >>

Newbie: Computed column in WHERE clause - how ?
Posted by AlexT at 10/31/2005 11:22:47 AM
Folks Probably a complete newbie question... I'd like to use the result of a computed column of my select in the said select WHERE clause. Something like SELECT ColIdx, COL1, (SELECT SUM(Ammount) FROM OtherTable WHERE (MyTable.ColIdx = OtherTable.colIdx)) AS TotAmmount FROM myTable WHERE ...more >>

Doubt aboult loop in trigger?
Posted by ReTF at 10/31/2005 10:48:21 AM
Hi all, I have one doubt, if anyone can helpe-me. I have one table that have one trigger (UPDATE), this trigger have one loop with 12 interactions, for each interaction I have one INSERT in other table. I did read that is not good put loop in trigger, this is true, if yes how I should do th...more >>

Query a pricelist for price breaks
Posted by Darious Snell at 10/31/2005 10:39:47 AM
The table looks like this: PARTNUM, BREAKPOINT, PRICE The table might contain data that looks like this: ABC,3,10.00 ABC,5,8.00 ABC,10,7.00 XYZ,5,13.00 How do I make a query that can give me the price if I supply a part number and quantity? For instance, if someone is buying 4 ABCs, th...more >>

How can I optimize this routine
Posted by Patrice at 10/31/2005 10:09:47 AM
I need to update a very large fact summary table with the detail data from other fact tables - what suggestions are there for making this perform better on the server? UPDATE STAGE_PHX_FACT_POLICY set county = FACT_POLICY_HO.County,Sub_County = FACT_POLICY_HO.Sub_County, Zipcode = FACT_PO...more >>

Null Column Question
Posted by roberto at 10/31/2005 9:41:29 AM
Hi, I am doing an outer join in my SP and sometimes the results will have a null value. I have tried the code below but it is still returning a null. How do I test for a null to return a ' ' value? SELCT CASE b.fcsetupsh WHEN NULL THEN ' ' END ...more >>

Conditional join
Posted by Terri at 10/31/2005 9:36:02 AM
Given 2 tables, Transactions and Instructions, my goal is to join a transaction to its appropriate instruction. The 3 fields I can possibly join on are: Exchange, SecType, and Country. All of these fields are nullable in the instruction table. Not my design, I can't change this. How can I jo...more >>

BCP/Bulk Insert and Incoming Dates
Posted by Mark Moss at 10/31/2005 9:07:06 AM
Ladies and Gentlemen Is their a way to force BCP to accept a Date Value of '000000' instead of giving an error? I am using BULK INSERT with a FORMAT FILE. Mark Moss ...more >>

How to View Transaction Log...
Posted by Eric at 10/31/2005 8:42:07 AM
I just had all data w/in about six tables deleted. I'm trying to figure out how this occured. Is there a way to view and make sense of the transaction log file(s)?...more >>

T-SQL statement performing quicker than same statement in sproc
Posted by Akeel Ahmed at 10/31/2005 8:36:09 AM
Hi guys, I have a sql query that returns some data in XML (for XML EXPLICIT), the query is encapsulated in to a stored procedure and runs in 2minutes (the sp has been freshly recompiled etc). If I however take the sql commands and run the query directly in query analyser (i.e. not in a spr...more >>

multi column subquery using IN clause
Posted by Kevin Shephard at 10/31/2005 8:35:03 AM
Is there a way to do a multi column subquery using a IN clause? Example of what works for Oracle and needs to get it to work for SQL Server 2000: SELECT * FROM Test T WHERE (T.Key1, T.Key2) IN (SELECT S.Key1, S.Key2 FROM SubSelect S WHERE S.End_Date IS NULL) I would l...more >>

How can wrap a case statement around us
Posted by Patrice at 10/31/2005 7:39:04 AM
I would like to maybe wrap a case statement around the following so that I can set any results that come back as NULL to 0 (the performance of updating afterwards is horrible) update STAGE_PHX_FACT_POLICY set STAGE_PHX_FACT_POLICY.fire_fee_if = whdata1.dbo.premium_detail.fee, STAGE_PHX_F...more >>

Trigger BEFORE DELETE to SET NULL into child
Posted by Tomas Skala at 10/31/2005 7:05:05 AM
I have 2 tables (ta [parent], tb[child]) and need ref. "...on delete set null" (SQL server doesn't know this by native). Alternative solution (generated by CASE soft) uses BEFORE DELETE TRIGGER (on parent table) to set NULL to all depending child table's record (not usable even). Problem i...more >>

Database Security Question - Can this be done?
Posted by Spence at 10/31/2005 4:03:51 AM
Hello, I am new to MS SQL Server and I am in the process of implementing a database system which introduces an interesting security issue that I was hoping some one could advise me on. BACKGROUND: I am developing a client / server application that which requires users to be able to downloa...more >>

Microsoft Distributed Transaction Coordinator call failed.
Posted by umer.zafar NO[at]SPAM gmail.com at 10/31/2005 2:19:23 AM
hi... I am trying to run MS DTC sample application (dblib) equipped with MS SQL Server 2000.I am using following commnd line to link SQL Servers on two different systems "dblib -s1 abc -u1 administator -p1 password1 -s2 xyz -u1 sa -p1 password2 " Server 1: my PC (OS Xp) Server 2: R...more >>

Where to find Unique Value indic of index in sys tables
Posted by Pierre Thienpont at 10/31/2005 2:13:05 AM
I am now looking for a few days for the "Unique Value" indic of an index. I can't find it in sysindexes, other sys table or information_schema. So I am missing something. I need it to generate some code Can somebody help me? tnx, Pierre ...more >>

how to send query from SQL Server using post method
Posted by vineet.jsl NO[at]SPAM gmail.com at 10/31/2005 1:12:04 AM
Hello Everyone i am new to SQL Server. i have a problem. i have to send a query string to a server using post method from a stored procedure. i got a stored procedure in some group for sending Http Post Request from Stored Procedure. but i dont know how to pass parameters and Http Header In...more >>

find missing numbers in a continuous serie
Posted by B.owl at 10/31/2005 12:52:05 AM
Hi I am receiving, on a regular basis, a massive xml files with invoices from our clients. The invoices have a unique InvoiceNumber. There is many types of invoices,(4 or 5), and each type will have a diferent invoiceNumber patern. Type 1 might be xxxxx Type 2 might be 1xxxxxxxx type 3 mi...more >>

need help to find a set based solution
Posted by Yaniv at 10/31/2005 12:00:00 AM
Hi, The goal of this script is to update the CurrentBalance column so it reflects the true current balance for each record based on the data in the Amount column. I will appreciate a set based solution because even though this is a one time process it takes longer time than I have. Th...more >>

Date Times and execution plans
Posted by Martin Selway at 10/31/2005 12:00:00 AM
Hi, I have an issue where a query on SQL uses a different execution plan dependent on a datetime value passed to it. If I use: declare @SiteId int set @SiteID = 201 declare @EligibleRecipient table ( UserId int not null ) declare @Cutoff DateTime declare @vccutoff as varchar(...more >>

Information Schema Query Question
Posted by Akintoye Olorode at 10/31/2005 12:00:00 AM
Hello All, Could someone help provide a query that I can run to determine the primary key and unique columns for any given table ? Thanks in Advance, Akintoye ...more >>

splitting names
Posted by Jason at 10/31/2005 12:00:00 AM
Hi, Is there a way to split names which are stored in one column to multiple columns (first name, prefix, lastname)?...more >>

Job and Stored Procedure Problems
Posted by Kevin Antel at 10/31/2005 12:00:00 AM
I've written 2 stored procedures. Proc 1, cycles through the system table and pulls out the names of all DB's. Proc 2 is called by Proc 1, after it grabs 1 of the database names. It then performs a type of backup based on a flag: F = Full, D = Differential, and T = Transaction Logs. I...more >>

help with indexes
Posted by HK at 10/31/2005 12:00:00 AM
I have a table that contains fields such as: ---------------------------------------------------------------------------- --------------- CustomerID ProductName SmallDateTime AnotherID1 AnotherID2 Amount --------------------------------------------------------------------...more >>

SQL server character type
Posted by SoccerManic at 10/31/2005 12:00:00 AM
My SQL server is set as case insensitive, 1252 character set. When trying to export some data (NVarchar) out from a table, I got some funny characters but viewing them from the Enterprise Manager or QA, they are perfectly normal. Can someone pls tell me what unicode type does MS SQL support?...more >>

Version and SP
Posted by Tor Inge Rislaa at 10/31/2005 12:00:00 AM
Where can I find what version and SP my SQL Server has. TIRislaa ...more >>


DevelopmentNow Blog