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 > july 2005 > threads for wednesday july 13

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

Counting Records
Posted by WhiteJul at 7/13/2005 10:35:15 PM
I have a table (transactionsTable) and I have several records from July 1st till today that I would like to count I prepared the following SQL statement but it does not work, please advise. Thanks Select count (*) from TransactionsTable where [date] = '2005/07/01' and '2005/07/14' ...more >>

select ....Not in (speed question)
Posted by Agnes at 7/13/2005 10:20:47 PM
My colleagues said "not minus is much faster than not in " in sql sytnax, I really don't understand Does someone know the reason and explain to me for this stupid question ? Thanks in advance ...more >>

NULL!
Posted by Arpan at 7/13/2005 9:04:24 PM
What does the following, taken from BOL, mean? ---------------------------------------- Null values are always considered equal for the purposes of the ORDER BY, GROUP BY & DISTINCT keywords, regardless of the ANSI_NULLS setting. Also, a unique index or UNIQUE constraint that allows NULL can c...more >>

SQL Server PVCS integration
Posted by DBADave at 7/13/2005 8:56:02 PM
Hi All, I am working with an organization that has standardized on using PVCS for code source control management. Does anyone know of a way to integrate PVCS with SQL Enterprise Manager, or a way to otherwise enable PVCS to manage database schema and code (stored procedures, views, tri...more >>

SQL Stored Proc Possiably unique question
Posted by TdarTdar at 7/13/2005 8:47:03 PM
Hello, I have a Stored proc that will return top 9 records. I want to keep the same output minus the first 4 records in another query Example: Select top 9 * from [items] 1 2 3 4 5 6 7 8 9 I want the same results as the above but minus the same first four records. Select Top 9...more >>

Remove Header
Posted by Chris at 7/13/2005 7:40:03 PM
Hi How can I remove the header of a selections statement. Example: ID Source OriginalID EntryTime ProcessTime DealType ...more >>

If statement Problems
Posted by quiglepops at 7/13/2005 6:55:13 PM
The below code, will not run for me, what happens is as follows, the first part of the if when run on its own, ignores the @CoMga variable and returns everything, the second part of the loop is supposed to spot if the variable has been entered (by checking its length) and then selecting based on ...more >>

String Comparison
Posted by Chris at 7/13/2005 6:46:06 PM
Hi May I know how can I extract out the ABCD, AAAAA content of the below string. Is the a similar function for string comparison as in Instr in VB? ABCD:12346536 AAAAA:12346536 ABCDASA:12346536 ABCE:12346536 Thank Regards Christina...more >>



sorting text numerically
Posted by Neil Jarman at 7/13/2005 6:04:46 PM
Hi, I have a list of numbers stored as varchars (because 12A is also valid, as is X33) bus numbers in fact. At present, because they are actually text, if I sort them, I get 1 10 11 .... 19 2 20 etc. I need these to be sorted numerically, where 2A appears after 2 but before ...more >>

TreeView
Posted by Trond at 7/13/2005 5:43:48 PM
I have a table with 3 columns ID (int, primary key), Function (varchar 200), ParentID (int) The purpose is to be able to build up an endless hierarchy of nodes. So lets say i have a structure like this: 1, System, 0 2, Cp, 1 3, Users, 1 4, Create user, 3 5, Edit users, 3 I should if...more >>

Security problem, anyone know how to overcome it?
Posted by Mark Stephens at 7/13/2005 4:37:09 PM
I need to supply raw data to a disctributed application in such a way that the user can use the data for graphing and analysis but cannot access the raw data. My idea is to supply the data in either an encrypted form or via sql (or mysql) and have it loaded into virtual memory (arrays) where i...more >>

Listing all fields where most are duplicate data
Posted by eagle at 7/13/2005 4:15:27 PM
I need to do a query that will return records where all data is the same except one field. For instance, a client table has a name, address, city, state, zip, comments. Because the database wasn't really set up correctly, many records have the same name, addres, city, state, zip, but only the c...more >>

Character Function for?
Posted by Mark at 7/13/2005 4:12:03 PM
Hello, Is there a function to tell me how many instances of a specified character there are in a given batch of characters. For instance, how many of the character [a] are found in the word [Alabama]? Thanks! Any help would be greatly appreciated....more >>

INSERT INTO ... EXEC against linked server
Posted by imarchenko at 7/13/2005 4:04:14 PM
Hello! I am having problem executing dynamic queries against linked server. Below is a code sample example I trying to execute: create table #tmp (name varchar(255) ) insert into #tmp (name) select top 9 name from [LinkedServer].master.dbo.sysobjects -- works insert into #tmp (nam...more >>

Trigger Creation, Permission, and Execution
Posted by gman997 at 7/13/2005 3:22:01 PM
Hi all, Here is the situation. I am trying to kick off an executable using xp_cmdshell through a trigger. I need to kick of the particular .exe which then raises an event to another system. However, I do not want to give the privileges to the user that will be making the inserts to execu...more >>

Update trigger on a self join (recursive)
Posted by Mark at 7/13/2005 2:25:30 PM
Hi I have a table that has a simple self joining parent child relationship. In this table records are flagged for deletion as opposed to being actually deleted. I would like to set a trigger so if deleteFlag is included in the update the child records are also updated, as are thier child...more >>

Who was the idiot
Posted by Michael C at 7/13/2005 2:21:41 PM
who found this issue that was fixed in SP4. :-) 823877 (http://support.microsoft.com/kb/823877/) FIX: An access violation may occur when you run a query that contains 32,000 or more OR clauses ...more >>

Problem with populating full-text catalog
Posted by abumelt2 at 7/13/2005 2:04:31 PM
Can anyone help me please? In one database, i have two tables that i need to index for full tex searching. No error occured when i created both catalogs nor when populated them. One catalog contains jpg, pdf, and doc files (iv installed the ifilters for jpg and pdf) and is working correctly...more >>

Tring to bring in date in the correct format from Platinum Database. Please assist. Thanks
Posted by Sam at 7/13/2005 2:03:35 PM
The date in SQL shows up as 729089 Even in Excel the grid shows for eg. the data as 3/29/3896 when I format the date as a Date. I was provided the following information but I am not sure how to change the date to show correctly. ------------------- Platinum SQL Version 4.2 Date sol...more >>

Multiple covering indexes on single-row table
Posted by Mike Jansen at 7/13/2005 1:33:34 PM
Setting aside comments on poor table design, I need input on resolving a production concurrency problem. Situation: A table with many columns but only one row exists for system settings. The frequency at which this table is hit is high, both for SELECTs and UPDATEs. However, most of the ...more >>

Number of records for Month X, created between 7AM and Noon
Posted by Patrick Rouse at 7/13/2005 1:30:03 PM
I have a table "patient_encounter" that stores a DateTime value for each record when it is created as "enc_timestamp". How can I determine how many records exist that were created between times X and Y for a given month? I want to see how many records were created for each month, for days Mo...more >>

Help with XP_Sendmail Stored Procedure
Posted by SQL Brad at 7/13/2005 1:22:02 PM
I was able to succesfully create the following commands in a dos prompt: 1> xp_sendmail @recipients = 'brad@mydomain.com', 2> @message = 'This is a test from the SQL ADMIN from Command Mode', 3> @subject = 'RBR Systems - SQL Server Auto Mailer System' 4> go Mail sent. I want to know how I ...more >>

Max timein, Order by Technician
Posted by tony tuso at 7/13/2005 1:05:42 PM
Hello, I have a table (loaction_Tech) that records technicains in the field. Fields are: LocationID_TechID - SKU TimeIn - Time the tech logged in TimeOut -Time the tech logged out TechID - Technician ID LocationID - Location ID FromLocation - Techs coming from Destination -Whe...more >>

MSDE question?
Posted by perspolis at 7/13/2005 12:37:18 PM
Hi All I want to use MSDE in my application. does that need licence?or can I use that at my application for free?? thx ...more >>

SQL Find Restrictions
Posted by xfd at 7/13/2005 12:22:08 PM
Fairly new to SQL. I have the statement below SELECT Fund_0, Fund_0_Description, Fund_1_Description FROM Fund_Type I want to be able to only have those records return where "Fund_1_Description" is within the "Fund_0_Description". Is this possible in the "Where" clause. Is this also cas...more >>

Sending Parameter to function
Posted by Aviv Sensel at 7/13/2005 12:05:57 PM
Hello there I've created user defined function that get datetime parameter, and returns table I used this function in T_Sql using join: SELECT * FROM Table1 JOIN dbo.fn(dte) It gave me an error: dte is not recognized OPTIMIZER LOCK HINTS option. Where can be the problem? ...more >>

Trigger is not calling trigger
Posted by Steven Yampolsky at 7/13/2005 11:58:55 AM
I have encountered this odd situation where an "instead of" delete trigger on a view does not call an insert trigger the same view. Please see attached script for a demonstration of what I mean. The expected result should be: Inside aview_delete_trigger trigger Inside aview_insert_trigger t...more >>

Need to be able to create a unique incrementing value in a char fi
Posted by C Villalba at 7/13/2005 11:58:02 AM
I need to be able to ensure the creation of a unique value in a specific field. The field is a char field but contains a numeric value which needs to be incremented. For example, xx-01 exists in sql, two preocesses want to insert a row at the same time so one would have to be xx-02 and the oth...more >>

Trigger is not calling trigger
Posted by Steven Yampolsky at 7/13/2005 11:54:11 AM
I have encountered this odd situation where an "instead of" delete trigger on a view does not call an insert trigger the same view. Please see attached script for a demonstration of what I mean. The expected result should be: Inside aview_delete_trigger trigger Inside aview_insert_trigger...more >>

Update Help
Posted by Lontae Jones at 7/13/2005 11:51:04 AM
I have a table called temp with one column called temp1 varchar(10) the values are 3323 2442 2424 2442 5566 I want to update the temp1 column so that they have a single quote in the beginning and end of the number example '3323' '2442' '2424' '2442' '5566' ...more >>

@@RowCOUNT
Posted by perspolis at 7/13/2005 11:41:55 AM
Hi all In a networking environment,Is @@ROWCOUNT safe for multithreading? I mean can I rely on @@ROWCOUNT variable to determine number of rows afftected with last statement?? Is it possible to be changed at the same time by another user?? thanks in advance ...more >>

Determining Descending Index using sys* tables
Posted by Lee at 7/13/2005 11:33:04 AM
I need to determine if any portion of an index is in descending order using the sys* tables. I've found the columns of each index using sysindexkeys and syscolumns, but can't determine if the column is being used in descending order or not. Any help would be greatly appreciated....more >>

Linking Active Directory with SQL server
Posted by Parag at 7/13/2005 11:12:46 AM
HiAll, I want to link active directory with the SQL server and query AD = using SQL. It is possible to do this . Does any one have any idea how to = do it?=20 Thanks and Regards Parag Kulkarni...more >>

SQL PUZZLE
Posted by MS User at 7/13/2005 10:39:33 AM
SQL 2K I have a table 'TripMovement' with columns CarID, TripType, TripDate, ....... (These three columns form the PRIMARY-KEY) Each trip will have an entry in table 'TripMovement' , there are four different 'TripType' (A, B, C and D) For a trip cycle, Trip will start with type 'A' ->...more >>

Cursor Update
Posted by manuel hernandez at 7/13/2005 10:17:05 AM
Hi All, Can it be possible to update records using a declared cursor in SQL? Say something like this: declare per_cur cursor for select perid, email, email2, email3 from tblper where perid is >= 15000 and perid is not null open per_cur fetch next from per_cur into @PerID, @pemail, @pemai...more >>

Newbie: Updates tables
Posted by steve at 7/13/2005 10:12:54 AM
Hi, I have the following problem which I can't seem to be able to find much on google: I have set up my DB with PKs and FKs and relations and everything. I want to update data, which means ***some of the new data might exist already*** and some (most) not. I will import them (csv) into ...more >>

Any Tricks from the Guru's
Posted by FlashMerlot at 7/13/2005 8:50:04 AM
Using SQL Server Ver 8.0 - I have this data ... 10/10/04 Foodlion Bananna 10/10/04 Safeways Bananna 10/10/04 Alberson Bananna 10/10/04 Meekerss Bananna 10/11/04 Foodlion Oranges 10/11/04 Safeways Oranges 10/11/04 Alberson Oranges 10/1...more >>

user security
Posted by jaylou at 7/13/2005 8:44:01 AM
Hi all, Is there a Q&D way to get a list of all users and their security rights? TIA, Joe ...more >>

Restore invdividual tables from complete backup
Posted by Steve W at 7/13/2005 8:30:08 AM
Is there a way to restore individual tables back into a sql 2000 database from a complete backup? I know there is a partial restore option, by which I can restore to a new database. If that is the only way, how do I copy all the data from the tables in the new database back to the old database? ...more >>

query system tables to get structure of a table
Posted by Jamie at 7/13/2005 8:13:00 AM
Hi, I want to query system databases to get a table structure of a SQL Server database. In other words, I want to dynamically create a new table with the same structure as one table on the same database. The structure infomation I need is: column name, column type, null or not. Does anyo...more >>

Fiscal Week Numbers
Posted by mark at 7/13/2005 7:43:03 AM
Hi I have a calendar table that has a row for each day in the year. The table has columns for date, month number, week number etc. I also want to store the fiscal week number. To illustrate: On a calendar basis week #1 starts (to keep things simple) on 01/01/2005. My fiscal year starts ...more >>

Increment value per ID
Posted by SteveWalker at 7/13/2005 6:58:01 AM
I'm working on converting a function from Access to SQL Server 2000 to improve speed, but I'm having a few problems... I'm returning a table of data which consists of a student ID and information about courses they're on, so there are multiple records for each student ID. I need to add a fi...more >>

Help! How to ...
Posted by ProJester at 7/13/2005 6:19:04 AM
how to transform this | TaskName | Total | EmployeeID | EmployeeName| -----------------+---------+------------------+------------------+ | task1 | 20 | 1| A| | task2 | 5 | 2| ...more >>

evaluating dinamically created SQL query
Posted by Sanyi at 7/13/2005 5:17:02 AM
Hi, MSSQL-2000 I would like to evaluate some SQL statements, that will be created in a stored procedure or function, how to do it? For example I would like to add as parameter some values or a list (in a string) that will needed in the following part of a statement: req_column in ('a','b...more >>

CONVERT Update query problem
Posted by AlexT at 7/13/2005 5:16:59 AM
Folks, Probably a trivial question, but what's wrong with ------ UPDATE dbo.LDec SET ldDateFROM = CONVERT(smalldatetime, ldDateFROMSTR, 101) WHERE (NOT (ldDateFROMSTR IS NULL)) ------ I want to update ldDateFROM (a smalldatetime) with the value stored in ldDateFROMSTR (s s...more >>

Join on Union result set
Posted by Steve at 7/13/2005 5:00:02 AM
Hi, Is there an easy way to do an INNER JOIN with results from a UNION ALL? I know i could put the results of the union into a temp table and join from there, but would like to avoid this if possible (due to the number of records involved). The other option i thought may be to put the union...more >>

Nesting Cursors.?
Posted by Chubbly Geezer at 7/13/2005 4:38:01 AM
Can anyone tell me whether this is possible. My initial attempts results in an error message informing me that a cursor with the same name as my 2nd cursor already exists. Thx...more >>

Determining Fiscal Quarter
Posted by mark at 7/13/2005 4:26:21 AM
Hi I have a calendar table with one row per day for the next 10 years or so. Each row holds the date, month, week number, quarter number etc. I also want to store the fiscal quarter in its own column. I populate the quarter column like so: UPDATE Calendar SET Quarter = CASE WHEN MONTH(r...more >>

inline user defined function (table value) - is it posible to use statements in the select statement
Posted by hha NO[at]SPAM twins.net at 7/13/2005 3:44:44 AM
Hi. I am pretty new to UDF's. and have en generel question. In an inline UDF, i know there kan only be one select statement, but is it possible to use, say case or if statements in the select statement. I am getting an "Incorrect syntax near the keyword", no mather what i do??? here is my c...more >>

25 MSDE Connections
Posted by Tom Celica at 7/13/2005 2:32:09 AM
In the MSDE Edition of Sql Server 2000 there is a limit of 25 = connections. What is the definition of a "connection"? For example, = if I create a connection pool of 5 connections in an application, does = that count as 5 against the 25? =20 -Thanks -Tom...more >>

Derived Table - Sum on one table
Posted by joss at 7/13/2005 2:21:28 AM
Hi All I have 3 tables : CREATE TABLE [dbo].[TP_theme] ( [ID] [int] NOT NULL , [theme] [nvarchar] (255)) CREATE TABLE [dbo].[TP_project_theme_actual] ( [ID] [int] IDENTITY (1, 1) NOT NULL ,[project_id] [int] NOT NULL ,[theme_id] [int] NOT NULL ,[year_id] [int] NOT NULL ,[value] [int] NOT...more >>

SQL Server UPDATE...FROM
Posted by throat.wobbler.mangrove NO[at]SPAM gmail.com at 7/13/2005 1:15:54 AM
Hi, Just a quick question I was hoping someone could help with? I'm relatively new to SQL Server, and have seen a few examples of UPDATE...FROM statements (e.g. UPDATE table 1 set field1=field1...FROM table2 join table3) that don't appear to have a WHERE clause. My question is, does such ...more >>

Increase Value by 1
Posted by Shapper at 7/13/2005 1:14:59 AM
Hello, I have an Access database table with 2 fields: [id] and [value] I need to increase the [value] field value by 1 for a certain given [id]. How can I do this? Thanks, Miguel ...more >>

Function & Dynamic SQL
Posted by Erencans at 7/13/2005 1:08:05 AM
Hi All, I've created a function and it's dynamic sql string. The sql string run in Query Analyzer but i cannot execute function. It raises error. Who can help me pls? Thaks alot... CREATE FUNCTION GiveNewNumber(@tableName AS VARCHAR(30), @increasedField AS VARCHAR(15), @...more >>


DevelopmentNow Blog