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 > may 2005 > threads for monday may 23

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

Query
Posted by Aleks at 5/23/2005 7:21:51 PM
I need a little help with this query. I am querying the value of field, but I need to add to the logic that if there is no record then the value = 1 This is the query as I have it: ------------- SELECT * FROM dbo.ParametersUsers WHERE UserId = 1713 and ParamName = 'showpopups' ---...more >>


Trigger does not always work
Posted by j.t.w NO[at]SPAM juno.com at 5/23/2005 6:08:57 PM
Hi all, I found this trigger and modified it to suit my needs. The original post can be found at: http://groups-beta.google.com/group/microsoft.public.sqlserver.programming/msg/efa94006811f18cf?hl=en Basically, what I am trying to do is get the Qty_To_Ship amounts of each line item in the s...more >>

Generating Surrogate Keys
Posted by GC at 5/23/2005 5:02:40 PM
I've been playing with a couple of ways of doing this, based on the ideas in the article "The Cost of GUID's as Primary Keys" : http://www.informit.com/articles/article.asp?p=25862&seqNum=1&rl=1 and a couple of other online sources and I've put together the following: create view builtin...more >>

product comparisons
Posted by Paul Pedersen at 5/23/2005 4:48:25 PM
I've been told that Oracle is a better choice than MSSQL for really large data sets and/or serious security concerns. But that was told to me by Oracle people. Without trying to start a war, can anyone give in a nutshell the relative merits of the two products? ...more >>

Why isn't this t-sql working?
Posted by df at 5/23/2005 4:42:05 PM
Hi All, This sql isn't working and I'm not sure exacly why. update verninfo.dbo.person set contno = (select contno from #UsersInVern where (upper(rtrim(#UsersInVern.first)) + upper(rtrim(#UsersInVern.last))) = upper(rtrim(verninfo.dbo.person.fname)) + upper(rtrim(vernin...more >>

crosstab?
Posted by r at 5/23/2005 4:24:19 PM
I've made "crosstab" queries in Access - it this doable in sql?? My table has: ID TestNumber Score Each user can have 1-3 records, one for each of the 3 tests. I need my output to look like this: ID Test1 Test2 Test3 --------------------------------- 1 score1 sc...more >>

Newbie Union and rownums
Posted by Tom at 5/23/2005 4:23:05 PM
I have a union on two select statements and the rownums obviously repeat. Is there any way I change the rownum with a forumula? I'd like to make 1st set of results to only be even numbers and the other odd numbers. Also if possible can I sort the entire set of results by date. Select r...more >>

New bie: Union statements and rownums
Posted by Tom at 5/23/2005 4:19:19 PM
I have a union on two select statements and the rownums obviously repeat. Is there any way I change the rownum with a forumula? I'd like to make 1st set of results to only be even numbers and the other odd numbers. Also if possible can I sort the entire set of results by date. Select r...more >>



BCP Problem
Posted by Tom at 5/23/2005 4:02:01 PM
I have some bcp archive files without the data format. Is there a way to get the data format from the archive files. Thanks...more >>

SQL distinct column counts
Posted by P at 5/23/2005 3:29:55 PM
The SQL below doesn’t work but may give an idea of what I’m trying to achieve. That is to obtain the count of a non-distinct combination of columns and a count of a distinct combination of columns SELECT count(cola, colb, colc) FROM tab1 SELECT count(distinct cola, colb, colc) FROM ...more >>

Parse output from xp_cmdshell
Posted by Joe K. at 5/23/2005 3:22:05 PM
I would like to write the output from (Exec master..xp_cmdshell 'dir E:\NewOrleans\*FULL.BAK') to a variable. I would like to test each line of the output variable to see if (wildcard.BAK) exist. If (wildcard.BAK) exist I append this code to my existing script. Please help me create th...more >>

Accessing global variables from SQL query
Posted by Chris Lieb at 5/23/2005 3:15:58 PM
I am trying to consolidate some code that I had replicated in many places in my DTS package by placing it in a Dynamic Property that sets a global variable. I can reference this variable through ActiveX Scripts with no problem. However, I can not figure out how to access it in an SQL query i...more >>

Query for each City the ZipCode with the highest Total
Posted by Scott at 5/23/2005 1:54:30 PM
Let's assume I have a table with the following fields: City, ZipCode, Total ... and the following data: Roswell 32032 100 Roswell 32032 120 Roswell 34589 75 Atlanta 31902 345 Atlanta 35865 200 Atlanta 46321 110 Denver 31411 25 Denver 31411 ...more >>

Error converting data type varchar to numeric.
Posted by Ric at 5/23/2005 1:11:59 PM
Excuse me for my english. Let us start with the base. I work with SQLServer 2000. My table has 12 columns of the type varchar Ex.:(Condition1_Min, Condition1_Max, Condition2_Min, Condition2_Max etc....) There are values which must be interpreted like the numerical one and of other as alph...more >>

Is there a better way to do this?
Posted by steve at 5/23/2005 1:08:15 PM
I have a stored proc that returns information depending on the particular column slelected by a passed in parameter. For Instance: Passed in parameters: @Rep = 876 @RepType = 2 SELECT * FROM Table1 T1 INNER JOIN Table2 T2 ON T1.Id = T2.Id WHERE CASE WHEN @RepType = 1 THEN T1.Rep1 ...more >>

SQL QUERY HELP PLEASE
Posted by Duane Haas at 5/23/2005 12:02:23 PM
Need help writing a query, I have the following so far: select device_id as MachineName, "name" as "FileName", path from RIM_Admin.FileAudit where "name" not like 'No File%' and path not like 'C:/REC%' What this query is doing is looking @ a table that has scanned machines in the company ...more >>

SQL Query
Posted by Duane Haas at 5/23/2005 11:44:21 AM
Need help writing a query, I have the following so far: select device_id as MachineName, "name" as "FileName", path from RIM_Admin.FileAudit where "name" not like 'No File%' and path not like 'C:/REC%' What this query is doing is looking @ a table that has scanned machines in the company ...more >>

Can't construct correct UPDATE script
Posted by larzeb at 5/23/2005 11:33:59 AM
I messed up an insert script somewhere and need to correct my data. The table which needs fixing is: Table Mailings AddressID int PersonID int NextMailDate datetime Sample data: AddressID PersonID NextMailDate 123 4 ...more >>

CREATE TABLE and column order
Posted by Edward Diener at 5/23/2005 11:02:08 AM
I create a table by sending a CREATE TABLE command to the database. The create is successful but when I look at the table in Enterprise Manager the order of the columns is in alphabetic order and not in the order I specified when I issued the CREATE TABLE command. Have the columns really bee...more >>

Terrible Update
Posted by Phil at 5/23/2005 10:28:27 AM
Hi All, I am trying to do a update on one table where the table that I am trying to update has matching columns in another table. Something like this. I have a table with these headings (Code, Age, Months, ID) I want to set the Code field to null where age, months, id match correspond...more >>

Backup Transaction Log on TempDb
Posted by Lontae Jones at 5/23/2005 10:20:09 AM
How can i backuplog on Tempdb using T-SQL? Its full...more >>

Unexpected behaviour from SQL Server SP4 in combination with Win2k
Posted by Ali at 5/23/2005 10:17:04 AM
Overview of problem I am getting anomolies with certain combinations of SQL Server SP4 and Windows 2003 where my query is grouping by two different columns, but the resultset returns the first of the two grouped columns displayed in both columns. If I reverse the order of the fields in the...more >>

Script to do count(*) on all tables
Posted by bagman3rd at 5/23/2005 10:16:32 AM
Is there a script to do a count(*) on all tables in a given db? Thanks. Archer...more >>

Query - need help using the IN function/statement
Posted by John Lloyd at 5/23/2005 10:13:51 AM
Hello all, I am trying to find the instances in a field containg specific keywords or strings of information. My table name is History, and my field name is Notes. So what I am trying to do is find every record where History.Notess conatins; 'chrom' or 'cell' or 'lab' I think I need...more >>

UDF - Inserting Data
Posted by Lionel Horn at 5/23/2005 10:11:59 AM
Is it possible to insert data into a table within a scalar UDF? I have an encrypted field in a table and a special UDF that decrypts the data. I want to be able to log each time the decrypt UDF is accessed. Here is a snippet of code that I would like to use within the UDF. The CardAcce...more >>

Limiting number of database connections per user
Posted by Dmitriy at 5/23/2005 10:10:32 AM
Hello, I would like to find out if it is possible in SQL Server 2000 to limit the number of concurrent database connections per user. I am new to SQL Server, and not sure if it is possible to limit it through some sort of parameter. Any help would be greatly appreciated. Thank you, Dmit...more >>

Will Changing System Clock on Server Destroy Data
Posted by Lontae Jones at 5/23/2005 10:10:08 AM
Hello, Will changing the stystem date back on a server for testing affect my data?...more >>

Another Question for the MVP's
Posted by REM7600 at 5/23/2005 8:31:17 AM
I have a quetion for one of the guru's on here... You've never failed me yet so I'm hopeful you might help me out again. Here's the scenario... (sorry, copy and paste with courier font for fixed spacing if it doesn't look right) Date EquipId Reading 04/01/05 12345 12 04/02/05 12345 1...more >>

Is this query addressing two Primary-Foreign rltnships in 3 tables
Posted by hazz at 5/23/2005 8:31:01 AM
Fresh post after Razvan cleaned up my DDL below. Given; declare @searchstr varchar(10), @vintageyr int set @searchstr = '%Lag%' set @vintageyr = '2005' SELECT * FROM VintageEst V WHERE EXISTS ( SELECT * FROM Block WHERE BlockName LIKE @searchstr ) AND EXISTS (SELECT * FROM...more >>

Execute sql script in the job
Posted by Test Test at 5/23/2005 7:46:24 AM
Hi! I want to run a sql script in the job using T-SQL against a user database. I tried to copy and paste the whole script in the T-SQL window of the job but bc of length of the script (it is too long), it truncated half of the script. How do I do that? Can we call this script using xp_cmdshel...more >>

SET NO COUNT ON
Posted by Prasad Patil at 5/23/2005 7:01:07 AM
Hi, Can i set the SET NOCOUNT ON option at the database level for all the stored procedures iin my database instead of modifying the exising stored procedures. I am using Sql Server 2000. Prasad...more >>

Arrays in SQL database
Posted by DavidC at 5/23/2005 6:56:28 AM
Hi; Can MS-SQL support Arrays? I need a float that occurs 72 times in a table and I don't want to have 72 seperate fields but can't see a way of creating an array? Thanks in advance. David *** Sent via Developersdex http://www.developersdex.com ***...more >>

Creating an "in memory" database
Posted by BBM at 5/23/2005 6:43:21 AM
Hi everyone, I am writing an application for which there are several large internal collections whose contents have to be filtered and sorted in various ways. To really take the cake, the contents of the collections may change during the process (objects coming from other threads). The ...more >>

logic of sum() with joins and using query hint
Posted by POKEMON at 5/23/2005 5:57:09 AM
hi everybody I have a question about the sum() function. when I join two tabeles and one of them is the main table which I used in the from statement, sum function I used for the joined table is giving the sum incorrectly(it is governing times the other joined tabele). how can i eleminate t...more >>

Different results - Not Exists Vs Not In
Posted by Core at 5/23/2005 5:40:06 AM
The following example results to differnet results depending upon whether I'm using Not exists or Not in. I'm sdoing the same thing in 2 different ways. Is there an explanation for this or is this a bug in SQL Server? Current Version SQL 2000 SP3a Example: Declare @temp1 table (...more >>

Copy Table with new Name in same Database
Posted by MarkCapo at 5/23/2005 3:46:05 AM
Hi Guys, Just wondering if anyone knows how to copy a SQL Table into the same database, whilst still maintaining all if its extended properties. I tried migrating from Access XP with different table name in Access, however it doesn't like it with regard to ext. properties, indexes, etc. ...more >>

Another Domain
Posted by Dave52 at 5/23/2005 1:21:06 AM
Hi, We have SQL Server 7.0 running on NT 4.0 ( I know we should have moved on but that's another story). We also have VB6 apps accessing the SQL Server using Windows authentication. Until now only users within our domain needed to use the apps. There are a number of NT security groups to w...more >>

Hierarchical Query
Posted by as at 5/23/2005 12:00:00 AM
I have a table representing a tree structure - self referencing table. For any node, I need to traverse upwards until root and retreives all the traversed nodes. With SQL only, how could I do this? In Oracle, there is START WITH, CONNECT BY clause to help me. What is the equivalence in sql ...more >>

Database log full
Posted by Tor Inge Rislaa at 5/23/2005 12:00:00 AM
What to do when the database log file is full? TIRislaa ...more >>

Should be easy
Posted by Michael C at 5/23/2005 12:00:00 AM
I've got 2 tables, Item and ItemDetail. An Item is considered to be complete when all of its ItemDetails have a value in the SomeOtherID field. An Item with no item details is considered to always be complete. In the sql below Items with ID 1 and 3 are complete because ItemDetailCount = Comple...more >>

previous row
Posted by Timmeah at 5/23/2005 12:00:00 AM
Hi, I am trying to do a query where I want to show not only the relevant results but the previous line as well. eg. select * where msg='crash' I have a rowno in there but I am pretty new to this stuff so not real sure. Thanks in advance Tim ...more >>

Question about Replication
Posted by Star at 5/23/2005 12:00:00 AM
Hi Let's suppose we have the following design (everything on the same server): Database1 (Publisher) Database2 (Publisher) Database1 and Database2 have the same structure. Now I create 2 subscribers on a database called 'DatabaseDest' Subscriber 1-> Source: Database1, Destination: ...more >>

Two or more cursors
Posted by A_X_L_X at 5/23/2005 12:00:00 AM
Hi, Could be a really simple question.... I have several tables that look very similar, I need to extract an identical recordset from each one based on table name passed to stored procedure, use cursor and do some heavy calculations. I need to be able to declare a cursor based on table name...more >>

error in sql and vb
Posted by javad.ebrahimnezhad at 5/23/2005 12:00:00 AM
hello to all i have a procedure blow in my sql server database and i userd it in a crestal report v9.2 -------------------------------------------- SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER PROCEDURE STTESTP @stklist as text AS exec ('select * from stunt...more >>

Inserting Values Into Primary Key and Foreign Key Tables
Posted by Willie Davis via SQLMonster.com at 5/23/2005 12:00:00 AM
I have two tables that I would like to insert values into at the same time and would like help with the SQL statement to do so. One table (Member_Info) has a PK and the other (Image_Info) a FK. The relationship the two tables share is through the (E_Mail) column. Example structure: Member_Info...more >>

oracle SQL - promping user input
Posted by Jackson Pollock via SQLMonster.com at 5/23/2005 12:00:00 AM
Hi, I have searched the very useful database you have here and although given some direction i still have a problem with a query i am working on. any help given would be greatly appreciated! the premise of query i am working on requires that a user be prompted for a variable found on table 3. ...more >>

Query - Join:
Posted by William at 5/23/2005 12:00:00 AM
What type of Query should I use to combine two sets of data into the same recordset. Note that none of the companies in TableA are the same as the companies in TableB (distinct sets of data). TableA Company, Sales, Members Table B Company, Members, Vacation Query Should Produce Co...more >>

Performance Views vs. Stored Procedure
Posted by Patrick Wolf at 5/23/2005 12:00:00 AM
Hi, is there a performance difference between using a View and a Stored Procedure (both returning the same result set)? Thanks a lot Patrick -- Please reply to group, rather than mail ad patrickwolf - net ...more >>

Simple query
Posted by Aleks at 5/23/2005 12:00:00 AM
I need a little help with this query. I am querying the value of field, but I need to add to the logic that if there is no record then the value = 1 This is the query as I have it: ------------- SELECT * FROM dbo.ParametersUsers WHERE UserId = 1713 and ParamName = 'showpopups' --...more >>


DevelopmentNow Blog