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


all groups > sql server programming > january 2006 > threads for tuesday january 17

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

Transaction question
Posted by Kevin Yu at 1/17/2006 10:18:52 PM
hi all, got a question, what's the different of .NET transaction ( using connection transaction ) and the transaction inside a store procedure? which is faster? does .net transaction use DTC? or both use DTC? thx Kevin ...more >>

DTS & Trigger
Posted by John at 1/17/2006 9:47:42 PM
Can anyone offer some advise. When a table holds a defined number of fields (determined from a count query) and a predefined time period has elapsed since the last email was sent I want to send an email to various recipients and set a date flag to state that an email was sent. Can this b...more >>

Are there any issues with installing SQL 05 on dual boot system - D drive?
Posted by moondaddy at 1/17/2006 9:47:37 PM
I want to setup VS 2005 and sql server 2005 on a dual boot system and it will be using the d drive. does anyone know of any issues regarding this type of setup? Thanks. -- moondaddy@nospam.nospam ...more >>

About CASE and WHERE
Posted by Raul La Torre at 1/17/2006 7:47:20 PM
*I have a Query like this: SELECT CARTERA_PROV.cCAJA, CAJA.sCAJA, CARTERA_PROV.fEMISION, CARTERA_PROV.fVENCIMIENTO FROM CARTERA_PROV, ANEXO, TIPO_DOCUMENTO, CAJA, CONCEPTO_GASTO, MOVIMIENTO_CAJA WHERE case CARTERA_PROV.cCONCEPTO_CARTERA when...more >>

LIKE % % statement
Posted by new coder at 1/17/2006 7:28:12 PM
I'm having some issues on a proc I'm creating. What it does is allow a user to pass in parameters for a .net search page. I have this but it does not return any data: select FirstName from customer where FirstName LIKE '% @FirstName %' is this correct? am i missing something? also anot...more >>

Debugging SPs in SQL Server 2005
Posted by Leila at 1/17/2006 7:20:16 PM
Hi, Are there any new feature for debugging non-CLR SPs in Management Studio? I couldn't find anything in BOL. Thanks in advance, Leila ...more >>

Primary key violation on update
Posted by John Baima at 1/17/2006 7:15:06 PM
I am getting a primary key violation with an update. My update statement is like update e set e.EID = neid.New_EID from EmpTable e inner join NewEID neid on neid.Tech_SSN = e.SSN and neid.New_EID not in (Select EID from EmpTable) The problem is that the final (Select EID from EmpTable...more >>

trigger and stored procedure
Posted by Bill at 1/17/2006 6:36:55 PM
I would like to create a trigger that would call a stored procedure in SQL Server 2000. This procedure would retrieve a users existing e-mail address from a table, give the user a new e-mail address and update the address information in a new table and send the user an e-mail confirmation. I w...more >>



master db id
Posted by js at 1/17/2006 5:30:33 PM
Hi, Is it master dbid alwasys 1? please help. Thanks. ...more >>

Select Max(somecolumn) + 1 problem??
Posted by Kevin Yu at 1/17/2006 5:15:49 PM
hi all got a question on the using select max(somecolumn) + 1 to get the unique id for a new record. since the select doesn't really have a lock on the table. so it's not thread safe. correct? this way, two users can get the same id return from the select statement. thx Kevin ...more >>

select & update data with special characters
Posted by Mike at 1/17/2006 5:05:01 PM
Hi, I am trying to update data that contains special characters. table: sqlCollection (this contains sql queries) column: sql I want to replace Test[select member='yes' where isnull({member_cat},'') !='catA' ] with Test[select member='yes' where isnull({member_cat},'') !='catA' and ...more >>

Instead Of Trigger Question
Posted by Rich at 1/17/2006 4:31:02 PM
Hello, I am taking over some projects frrom a real sharp young guy who is/has moved on the bigger and better things - of course, ZERO documentation :). Below is an Instead Of Update Trigger on a table (I am pretty sure this is an Instead Of trigger). I believe there is no reason this can...more >>

INSERT Help Required
Posted by RitaG at 1/17/2006 3:52:02 PM
Hello. I have a pretty simple INSERT statement that's pulling data from 3 files. The one table Table3 (SM) has 1000's of rows all with the same Effective and Termination dates. My main table Table1 (IDS1) has 5 rows. I need to pick up the Effective and Termination dates from Table3 but s...more >>

Some assistance with MS SQL injection and PHP please
Posted by gene.ellis NO[at]SPAM gmail.com at 1/17/2006 3:33:54 PM
Hello everyone, Put simply we have recently been the victims of a malicious hacker because we were not aware of the dangers of SQL injection. Now, I am adding addition validation to my forms and also GET variables (we are using PHP). Does anyone have any good techniques for the kind of valida...more >>

System.Data.NoNullAllowedException: Column 'frDateCreated' does not allow nulls
Posted by Martin Widmer at 1/17/2006 3:17:14 PM
Hi guys! I get this message when trying to insert a new record into a datatabel which is part of a dataset connected within VS 2005 (VB) from a datagridview control via a DataTableBindingSource and TableAdapter to an SQL Server. In the SQL server the field is declared as "do now allow null"...more >>

OT: Need Some Help
Posted by Si at 1/17/2006 1:29:50 PM
Hi I know this is off-topic, but I'm looking for some knowledgeable people... The company where I work have an application which uses VB6 for the front end and SQL Server for the back end. The front end uses the (published) stored procedure API to access the database. The business ...more >>

Selecting Max Value
Posted by CJM at 1/17/2006 1:10:52 PM
I already have a solution to this, but I have a feeling that there is a better way to do it... I have a table containing information on Serial Numbers; in the past, when the information is edited, the original row is left alone, and the data is copied to a new row with an incremented Sequen...more >>

Need paragraph breaks in pass through query
Posted by ILCSP NO[at]SPAM NETZERO.NET at 1/17/2006 12:38:07 PM
Hello, I'm trying to use a pass through query in which I want to recreate something that I can do in the query analyzer. I'm using Access 2K as front end and MS SQL Server 2000 as back end. I want to create a view, use a select statement using this view linked to a table and then I want to dro...more >>

Determining User Role via DMO
Posted by OBQuiet at 1/17/2006 12:29:08 PM
I am trying to find a way to check if a user belongs to a program specific role. Previously we had been using: // Not Exact but I think it can be followed hr = m_pDmoSrvr->GetTrueLogin(&login); LPSQLDMOUSER pUser = 0; hr = m_pDmoDb->GetUserByName(login, &pUser); hr = pUser->IsM...more >>

HOWTO: Select multiple categories joined with a record?
Posted by R Reyes at 1/17/2006 12:28:02 PM
I have 2 tables: TBL_Client and TBL_ClientCategory TBL_Client ============ ClientID = key FirstName LastName TBL_ClientCategory ============ CompanyCategoryID = key CategoryID ClientID Why does this SQL not work?: SELECT * FROM TBL_Client INNER JOIN TBL_ClientCategory ON TBL_Clie...more >>

DateTime types and getdate() comparison
Posted by Liam at 1/17/2006 12:23:23 PM
SQL 2000. Let's say column MyDate is a datetime type. Is this comparison syntax OK as is? ..... where MyDate <= getdate() Or is some formatting of the column value and/or of the function's return value required for the comparison to work? Thanks Liam...more >>

Embed VBS or Call VBS from Job Script
Posted by Whispering Leaf at 1/17/2006 12:13:01 PM
How do you call an external VBS script from within a T-SQL Job? At the end of a job I want a VBS to fire off in the last step. Not sure how to do this. Looked everywhere ... :)...more >>

need help with sql query
Posted by Chris at 1/17/2006 12:04:06 PM
Hi, I have a user table that is connected to a report table by the userid. user table fields: userid user name report table fields: userid (short int) report number (values being 1, 2, 3,4, or 5) report location (values being a, b, c or e) hasaccess (bit) the relationship is one(us...more >>

Creating a view between 2 different Datasources
Posted by Will Chamberlain at 1/17/2006 12:00:45 PM
I want to create a SQL server view that combines 2 tables on 2 different servers. Both of the servers are in house and I have permission to view both of them. What is the easiest way to go about doing this? I am able to create a view with multiple tables on one server but have never had to cr...more >>

ALTER TABLE Question
Posted by glen at 1/17/2006 11:56:55 AM
I have a temp table I'm filling from two different data sources. I then do an ALTER TABLE statement to add an identity column. So far so good. But when try to select the first x number of records using the identity column to put into a cursor I get a 'Invalid Column Name' error. Anyone give me...more >>

Calendar table SELECT
Posted by Terri at 1/17/2006 11:08:31 AM
I want to use a stored procedure and a calendar table to determine: 1) Is it the first business day of the month?; and 2) What was the last business day of the previous month? CREATE PROCEDURE procTest AS --psuedo code Is today the first business day of the month? If yes then determi...more >>

divide by zero error
Posted by amber at 1/17/2006 11:07:03 AM
Hello, When I originally wrote the SQL below, I didn't think the last two fields could ever be zero, but I was wrong. How can I rewrite this so if NUM_PRODUCTION or NUM_PIECE_SIZE are zero, TotWithFuel simply equals zero? SELECT (dbo.TDT_CUT_BLOCK_LGN_FALLING.NUM_RATE + (dbo.TDT_CUT_BLOCK...more >>

query in query?
Posted by dot at 1/17/2006 10:59:38 AM
Hi, I have a database containing student historical data about subscriptions to departments in a school. Example data for 1 student: studID: 0001 deptID: 1 dateIN: 01/01/2004 dateOUT: 01/01/2005 studID: 0001 deptID: 1 dateIN: 01/01/2005 dateOUT: 01/01/2006 studID: 0001 deptID...more >>

Get the ID from Min(grouppingcolumn)
Posted by Kiran at 1/17/2006 10:52:36 AM
Hi, I have a simple query, select emp_group,min(salary) from employees group by emp_group. now I get the results. Is there a way to get the ID(Primary key Column) value for which the query returned minimum salary. Thanks Kiran...more >>

Problem causing batch file with xp_cmdshell
Posted by meverts at 1/17/2006 10:52:05 AM
I am trying to execute a batch file in my query using the xp_cmdshell command. I would like to add this to my stored procedure, but am currenly just using SQL query analyzer. Here is my code. declare @OrderNumber varchar(50) Set @OrderNumber = '2006-0160016' Update dtbl_labelInfo ...more >>

database migration
Posted by ben at 1/17/2006 10:48:55 AM
Hi, I wonder wether a software or a device (or script) allowing to migrate data from an existant database to a new database by using correspondant ODBC drivers existed. Thanks for your help. ...more >>

Rolling Month Query
Posted by dustin NO[at]SPAM onlineimprint.com at 1/17/2006 10:48:38 AM
I am trying to do the following: Objective: Check to see if a store has recorded 'Actual' sales at least once for each three month period starting 1.1.00 through 3.1.05. At least once for Jan, Feb, Mar of 2000. Then at least once for Feb, Mar, Apr. Then Mar, Apr, May, and so on through to t...more >>

Help with query
Posted by Newbie at 1/17/2006 10:21:41 AM
Hi guys, I wonder if I may ask for your help here. I have two tables RoleNames and Roles where RoleNames are the available roles and Roles are the Roles which the users 'may' have. RoleName ID int RoleName char(10) Roles RoleID int user_name NVCHAR I need to find our what roles a...more >>

copying data accross databases for backup
Posted by adg at 1/17/2006 10:21:33 AM
I am not an expert in SQL I am faced with the task of copying certain attributes froma table in a database to create a table in another database to have a sort of refined backup database.I have to do it through a script to run in Sqlserver query analyser I have created a query of sort -> sel...more >>

Role Permissions
Posted by Prasad at 1/17/2006 10:17:32 AM
Hi, I am trying the following on SQL Server 2005. I want to find out the permissions for different roles on database and database objects. So, selected all the records from the "sys.database_permissions" catalog view and joined it with the "sys.all_objects" catalog view. But I found some...more >>

Syntax error near MOVE
Posted by Calvin X at 1/17/2006 10:14:21 AM
I am getting a syntax error reported on line 9 (the last move or perhaps the one before it) If i remove the last line then it seems to be ok but I need to move the transaction log as well. Thanks BACKUP DATABASE Internal TO DISK = 'C:\Work Folder\Sql Server\testing.bak' RESTORE FILELIS...more >>

problem with output SP that takes Input
Posted by Rich at 1/17/2006 10:10:04 AM
Hello, I am trying to run/test an SP in Query Analyzer. The SP takes an input param and outputs a value. How do I set this up in QA? Here is the SP CREATE proc sp_Company_Workshop_Exists @RecordID int, @WorkshopExists bit output as if exists ( select * from Workshop a inner joi...more >>

Limit of SQL2k table....
Posted by Nestor at 1/17/2006 10:08:37 AM
I'm coming across a problem with SQL2k. One of my SP which involved inserting and updating of records on a huge table (hundreds of millions records) is returning me errors without a proper error description. I'm suspecting that the maximum size of SQL2k table has been reached for this table...more >>

convert into to hours minutes
Posted by Joey Martin at 1/17/2006 9:58:56 AM
Someone else setup the table and I cannot change it, so I am stuck with what I have. I have an INT field called hourminute. The data is 3-4 digits, and is always based on hour/minute in 24-hour format. I need the output to be hh:mm. In the field, there is not a COLON and that is what I n...more >>

CREATE TABLE with multiple-column primary key?
Posted by Carl Imthurn at 1/17/2006 9:56:17 AM
Is it possible to issue the CREATE TABLE command and specify a multiple-column primary key? If so, what is the syntax? I've checked BOL and as far as I can tell, you may only select a single column as the primary key *within the CREATE TABLE command*; ALTER TABLE must be used for multiple-column ...more >>

ODBC In Stored Procedure
Posted by Pumkin at 1/17/2006 9:03:04 AM
Hey guys, I'm trying to get the column names from a table to which I'm connected through OBDC. I don't want to use linked server. I get my data with Openrowset. I found the SQLDescribeCol and SQLColumns ODBC functions. Can anybody tell me how to use those functions in a SQL Server stored proce...more >>

A question on database design
Posted by Simon Harvey at 1/17/2006 7:28:49 AM
Hi everyone, I'm hoping someone could give me some advice on how to achieve the following. I'm making a system that stores information on holiday homes. In particular I need to store information on their bookings. When is a home occupied and for how long. I've considered making a Bookin...more >>

How can I find a comma in a field
Posted by JD at 1/17/2006 7:00:02 AM
I want to check a colum in a table to see if any rows contain a comma. How can I do this, is there a function in sql server to check for existance of a certain character in a field? thanks...more >>

Contains(@v1, @v2) Is this legal?
Posted by kapsolas at 1/17/2006 6:40:02 AM
I am attempting to perform a contains of one variable string in another. here is a simple example of what I am attempting to do, this should return true, but I am not sure if this is a limitation of sql server, that it will now allow a contains on two datatypes. Any ideas? declare @t1 varc...more >>

Why do these queries return a diff. # of records?
Posted by Eric at 1/17/2006 6:38:02 AM
This query returns 1579 rows: SELECT DISTINCT CUSTOMER_NAME, CUSTOMER_ID FROM TRANSACTIONS INNER JOIN CUSTOMERS ON CUSTOMERS.CUSTOMERID = TRANSACTIONS.CUSTOMER_ID INNER JOIN ADMIN ON ADMIN.USER_NAME = TRANSACTIONS.USER_NAME WHERE ADMIN.COMPANY_ID NOT IN ...more >>

CTE to replace cursor
Posted by jamie.downs NO[at]SPAM risk.sungard.com at 1/17/2006 6:22:29 AM
I am trying to replace a cursor with a CTE. Is it possible to scroll through the records returned using the CTE? i.e. If I get more than one row returned check the values in each row? A bit like a result set? I know there is some recursive stuff you can do but I don't think it will work ...more >>

Trying to get xml data with unknown level of nesting
Posted by chippy at 1/17/2006 6:11:44 AM
I am faced with the problem of pulling out XML from a SQL Server database (using option explicit) when the level of nesting of some of the elements is unknown. The table structure is similar to the following: msgTable ------------- msgName msgID ------------- msgOne 10001 segTable ...more >>

passing or defaulting null
Posted by Mumbai_Chef at 1/17/2006 6:06:02 AM
I wanted to know what are the advantages/disadvantages of passing null values in the sp as oppose to setting them as default in the tables. I am using SQL 2005, "set ANSI_NULLS ON". Thanks ...more >>

Qyery returns different results on SQL server 7.0 and 2000.
Posted by Manoj9 at 1/17/2006 5:29:02 AM
SELECT CASE WHEN ISNUMERIC(t.clnum)=1 THEN (SELECT CASE WHEN PropertyAddressOptionCode = 'F' THEN 1 WHEN PropertyAddressOptionCo...more >>

Previous and next ID
Posted by Mike at 1/17/2006 5:16:05 AM
I'd like to find the previous and next record of a table based on the numeric value of an identity column. For example, consider the following sample data: RecID | theValue --------------- 1 | first 2 | second 4 | third 6 | fourth 7 | fifth If the value '4' is pass...more >>

Data Modeling question
Posted by ccjjharmonDOTREMOVE NO[at]SPAM dotRemovedotgmaildotcom at 1/17/2006 5:06:16 AM
We are wanting to model standards for the equipment. But for each equipment, there may be a completely different set of characteristics that make up its standard. There's more to it than just this, but let's keep it simple here. What would be clear and obvious to anyone who's done even a basic A...more >>

Sub select with retrieval argument doesn't work
Posted by Barry P at 1/17/2006 3:22:02 AM
Apologies if this is too basic. We have just changed from using MSS Microsoft SQL Server 6.x DBMS to ueing ODBC and the following no longer works: SELECT cffe_use_fld_nm.use_fld_id , cffe_use_fld_nm.use_fld_nm FROM cffe_use_fld_nm WHERE ( cffe_use_fld_nm.use_fld_id not in...more >>

Overlapping Records by DateTime
Posted by Andy Furnival at 1/17/2006 1:41:03 AM
Hi guys and gals, I need to pick your brains for a date/time series question. I'm trying to write a query that will displays accounts, with their different account types that overlap using the start and end dates. So say I have the following records:- AccountId - AccountType - Start ...more >>

RDA with limited connectivity
Posted by ohs at 1/17/2006 1:04:42 AM
Apologies for cross posting but I can't figure where to post. Please feel free to move my message elsewhere (notify mat<at>oldhallsoftware<.>com) cheers I have an ASP.net app that mobile service engineers use to exchange info with our back office systems thru GPRS. Works great but my com...more >>


DevelopmentNow Blog