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 > october 2005 > threads for thursday october 27

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

Help with SQL query
Posted by Tim Harvey at 10/27/2005 11:19:57 PM
Please bare with me in trying to get my point across, I'm new to SQL and would appreciate the help so much. I have two table Table1 and Table2. There is a one to many relationship between Table1 and Table2. Table2 has a list of widgets, I need to create a query that would show the records f...more >>

help with proc
Posted by raghu veer at 10/27/2005 10:16:02 PM
i wrote a procedure which calculates how many minutes a person is late to the office on a particular day what is the best method for converting it to calculate the minutes late for the whole month...more >>

newbie select and update
Posted by CobraStrikes NO[at]SPAM al.com at 10/27/2005 8:54:51 PM
Hi All, Is it possible to update a column but return orignal value in one operation, any help will be appreciated. select c1 from table; update [table] set c1=? where c1=value from select Thank You. ...more >>

DataTypeEnum problem with datetime data type
Posted by Curt Morrison at 10/27/2005 7:50:15 PM
If anyone can help, I'd really appreciate it. I could swear this worked successfully before, but now I'm getting: Microsoft OLE DB Provider for SQL Server error '80040e14' Implicit conversion from data type datetime to bit is not allowed. Use the CONVERT function to run this query. ...more >>

Timeout when IDataReader.Read()
Posted by Terry at 10/27/2005 7:26:02 PM
I encountered a “timeout” problem in my recent project, which has been torching me for some days, and hereby is the description of that problem. Environment: Windows 2003 Server + MS SQL Server 2000/MSDE (SP4 applied) There are around 1 million to 2 million records in a table named as ...more >>

Concept for View
Posted by Ed at 10/27/2005 7:22:02 PM
Hi, Could someone please explain to me when the view is updatable and when it is not? I am under the impression that if the two tables are joined together in the view, then the view is not updatable... is it correct? Thanks...more >>

About FILEGROUP
Posted by ReTF at 10/27/2005 7:04:12 PM
Hi all, I would like know if I create many FILEGROUPs in SQL, this will help to increase performance of this SQL Server. Thanks ...more >>

unique but allow nulls
Posted by Keith G Hicks at 10/27/2005 5:24:05 PM
What's the best way to do this? I have a field that I want to force unique for rows that the column is filled in but it's ok for the column to be null. Does this have to be done in a trigger or is there an easier way? Thanks, Keith ...more >>



Computing Dates
Posted by BobD at 10/27/2005 4:03:18 PM
I'm soliciting any suggestions from the readers of the group on how best to tackle this task. I need to determine if trouble tickets opened get closed within 4 hours. Yes, I already know about datediff(hh, date1, date2, but it's not that simple. The thing I'm struggle with is that I need to t...more >>

Query with changing table names
Posted by Steve Roberts at 10/27/2005 3:18:04 PM
We have a web tracking program that came with our firewall that writes it's data to a MSDE database. Unfortunately it writes each day's data to a different table. It names them connection_events_2005_10_20 then connection_events_2005_10_21 etc... I need to create a report by the week from all o...more >>

update based on criteria
Posted by Dion at 10/27/2005 2:26:03 PM
jeez - I hate it when something basic gets me stumped, but I keep having trouble with my transition from an Access mind set to a SQL mindset. Anyway, I have a simple update query that works: update PhaedrusPatTable set Room=rtrim(uap.Room) from dbo.UrizenAdmPat1 uap join PhaedrusPatTable p...more >>

Create view using UNION
Posted by Man Utd at 10/27/2005 2:00:24 PM
I have 2 tables with exact structure: Employee: ID FirstName LastName Position ExEmployee: ID FirstName LastName Position And the reference table Position: ID Name I want to create a view something like: CREATE VIEW viewEMPLOEE_ALL as SELECT e.ID AS EmployeeID, e.Firs...more >>

Reading Long Varchar
Posted by Guadala Harry at 10/27/2005 1:43:29 PM
Using QA I can only see a limited portion of long varchar columns (e.g., varchar (600)) when I SELECT. The returned value gets cut off after about 100 or so characters. How can I see all of the value? Thanks! ...more >>

SQL Query: Conditionally updating a column
Posted by CJM at 10/27/2005 1:25:46 PM
I have a query which 'Completes' any open orders where all order lines are complete, cancelled, closed etc The requirements have changed now and I need to modify this code so that it sets an order as 'Complete' if all orderlines are Complete/Cancelled/Failed Delivery, but to set the order s...more >>

Running Store procedures
Posted by Roy Goldhammer at 10/27/2005 12:10:17 PM
Hello there I have some procedure that i would like to build store procedure for it If two users who which their name is dbo and run the same store procedure at the same time, and the store procedure using temp tables. will it cause problems? and if so what is the way to deal with these p...more >>

Cancel showing output
Posted by Roy Goldhammer at 10/27/2005 11:59:29 AM
Hello there I have an update trigger that must be run only if i update one record only. To do this i add this code: SELECT 1 FROM Inserted IF @@Rowcount=1 BEGIN .. the update single record code END This code works exept that it has an output. Is there a way to cancel the out...more >>

dynamic SQL and adding records to a table
Posted by amber at 10/27/2005 11:59:20 AM
Hi there, I know nothing about dynamic SQL, but was helped to create a stored procedure that enabled me to use a table whose name was provided at run time. This stored procedure simply read records. Now I want to create new records in the same manner. My stored procedure for reading these re...more >>

How to Alter Column to Identity NOT FOR REPLICATION?
Posted by Perayu at 10/27/2005 11:54:47 AM
Hello, ALL: I have following DDL for my curretn Address table: CREATE TABLE [dbo].[Address] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Street1] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Street2] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [City] [varchar] (...more >>

Convert
Posted by SOHO at 10/27/2005 11:39:27 AM
Hi All, Sample:- Declare @xx varchar(10) select @xx = '1x' select convert(int, @xx) && Error ½Ð°Ý¥i§_¤£¥Î¥X error , ¥H­P System °±¤î. ¦]¬° @xx ¥»¬°¤@Äæ¦ì, ¸ê®Æ¤£½T©w¥i Convert. -- Thanks ! ...more >>

Preventing Extended Properties
Posted by tascienu NO[at]SPAM ecoaches.com at 10/27/2005 10:15:34 AM
Is there a way to tell SQL Server not to bother storing extended properties? I see no use for these, except bothering me when i am creating SQL scripts for recreation on another database.... Any way to do that? Tascien ...more >>

Job Fails when scheduled
Posted by DBA at 10/27/2005 9:40:21 AM
Another user who has sa privledges created a job to run an update on a table. I modifed it for him. Then I shceduled it. I or he can run it manaully and it works fine, but when scheduled, it bombs everytime. HELP...more >>

Problem with SELECT...WHERE IN procedure
Posted by Anders at 10/27/2005 9:25:54 AM
This works! SELECT au_lname, state FROM authors WHERE state IN ('CA', 'IN', 'MD') ---------- But when I do the same in a proc it doesn't! create procedure mytest @test varchar(1000) as SELECT au_lname, state FROM authors WHERE state IN (@test) go Call proc: exec tes...more >>

update sql server table from dbase IV
Posted by steal at 10/27/2005 9:25:06 AM
Is it possible to update a field in a SQL table from a dBase IV data source? I'm working in an old VB6 app, currently it is very error prone and takes up to 20 minutes to process 20-30 records! I'd like to write a SQL stored procedure to do this instead of the nasty VB code that is doing it ...more >>

strange conversion
Posted by helmut woess at 10/27/2005 9:13:16 AM
Hi, i tried this in the QueryAnalizer: declare @f double precision, @s varchar(20) set @f = 1123.452123 select @s = cast(@f as varchar) select @f, @s and see as result: 1123.452123 1123.45 which means, i have lost some of my digits during convert to a string. But what must i do ...more >>

SELECT by DATE (doubt)
Posted by ReTF at 10/27/2005 8:59:00 AM
Hi all, I have one table with many rows, and one column of this table is a DATETIME (CONSTRAINT gdtdf DEFAULT GETDATE() ), I need select rows by day, I did try this: SELECT * FROM transacoes WHERE data = convert(nvarchar, getdate(), 112) but this didn't return nothing, I have 3 rows with...more >>

Can SQL Server do this?
Posted by Brent White at 10/27/2005 8:51:59 AM
I was curious. I am building a filter string on a webpage to pass to a stored procedure. The filter string would be some kind of IN clause. Is there a way to pass the IN clause to the stored procedure? For instance, let's say you have a stored procedure called MyProc It takes 1 paramet...more >>

1st column sequential output
Posted by Bob at 10/27/2005 8:48:59 AM
I have a table as follows: EmpID Name 1027 Jason 1032 Amy 1059 Robert 1193 James 1202 Kelly I want to have an output with a 1st column that shows the ranking sequentially as follows: ID EmpID Name 1 1032 Amy 2 1193 James 3 1027 Jason 4 120...more >>

Data Types
Posted by TS at 10/27/2005 8:26:13 AM
I'm creating a windows .net form that has SQL as the back-end. One of the controls is a group box with three radio buttons options. What data type should this column have, so whatever option the user chooses will be saved on the SQL table? Another one, a YES/NO field, what data type should ...more >>

Alter a column to allow null or not null values if meets criteria
Posted by imagabo at 10/27/2005 7:47:28 AM
I'm very new working with SQL server and I'm trying to create a check constraint that will allow the an specific field to be null only if the result on a second field is zero and not null if this result is greater than zero. My boss is pushing me to implement this criteria on my SQL database ri...more >>

check link server availability in sp
Posted by rinfo NO[at]SPAM mail.com at 10/27/2005 7:43:49 AM
I am changing a stored proc to use linked servers. We have 5 linked sql servers, each in different physical locations and from time to time the network connection at one of the locations may go down. It is critical that if I can't get to a linked server, that my sp doesn't fail and return an e...more >>

Simple Count Function help
Posted by Patrice at 10/27/2005 7:10:03 AM
Hi, I am trying to perform what should be a simple count function, I need to count how many times a record has an instance based on an "Identifier" with the unique combination of 'Policy Number", Policy Date Time" with the policy date time stamp being MAX select policy_number,count(addl_...more >>

Easy Date Problem
Posted by brentkelli NO[at]SPAM gmail.com at 10/27/2005 6:41:38 AM
I am somewhat new to SQL and was trying to subtract 11 days from today but I want it to go to 00:00:00 rather than 11 days whatever time it is I run it. Example: It is 8:39 AM right now and when I run where completiondate BETWEEN getdate()-11 and getdate()-5 I want the result to be xx/xx/...more >>

Insert not returning Identity
Posted by Phill at 10/27/2005 5:33:17 AM
I have a SP that inserts a record and is supposed to return the id, which is an identity column. The record is inserted ok and the id is incremented, but the value is not returned. What could be the problem? Here is my SP: CREATE PROCEDURE [WFM_LOOPS_INSERT] (@SR_Number_2 [int], @Pole_...more >>

How to change collation settings of a database
Posted by Daniel Walzenbach at 10/27/2005 3:49:10 AM
Hi, what would be the best way to change the collation settings of a database? I need to change the collation from SQL_Latin1_General_CP1_CI_AS to Latin1_General_CI_AS. Thank you a lot in advance! Daniel...more >>

Need Help Regarding SQL Query
Posted by Atif Iqbal at 10/27/2005 3:07:41 AM
HI, I've a database with 250,000+ records records are being logged in realtime with 5 mins of interval. Now what i want is to query the database and on the basis of some calculations i want to display records of every hour total in a 24 hours day separetly. I want the result in one query...more >>

how much index are reasonable on a table?
Posted by SOHAIL MALIK at 10/27/2005 2:55:02 AM
I have a table with about 25 colums. In my application, we have provided an interface through which , search can be made on different column, either alone or with combination of different columns. Now there are about 10 columns , upon which search can be made, either indicidually colum, or co...more >>

how much index are reasonable on a table?
Posted by SOHAIL MALIK at 10/27/2005 2:54:04 AM
I have a table with about 25 colums. In my application, we have provided an interface through which , search can be made on different column, either alone or with combination of different columns. Now there are about 10 columns , upon which search can be made, either indicidually colum, or co...more >>

Email ID Validation in SQL Query
Posted by Dinesh at 10/27/2005 2:19:04 AM
Hi, Can someone help me with a query to validate if a value stored in the emailaddress field in a table is a valid email id or no. Please mail me ASAP. Thanks in advance. Regards Dinesh...more >>

Update for random sampling featutre
Posted by hals_left at 10/27/2005 2:18:34 AM
Hi I need to run a proc that updates a random selection of records. I have a column called Sampled which is type bit, default 0 against each record. When I run the proc I need to set a selected number of the values to 1, selecting them randomly. Any ideas? Thanks. ...more >>

Stored Procedure concurreny
Posted by Philip L. Nielsen at 10/27/2005 12:50:02 AM
Hi, I was wondering how concurrency regarding Stored Procedures is working. Assume we have 2 clients(user#1 and user#2) connected to the same database. If these clients call the same stored procedure, will it always run "serializable"? I mean, could you get into the situation, where user...more >>

constraint?
Posted by Jason at 10/27/2005 12:00:00 AM
Hi, I was wondering how i could set up a constraint if i want to prevent duplicates. For example, in a table where i have 4 columns: -id (identity and primary) -contactid -type -period One can have values like: id | contactid | type | period 1 c123 1 11 2 c355 | 2 | 11 N...more >>

Triggle rule change name ?
Posted by Agnes at 10/27/2005 12:00:00 AM
Does anyone know how to change the triggle rule's name ?? Thanks ...more >>

Database Design problem
Posted by Agnes at 10/27/2005 12:00:00 AM
My Account database got around 50tables , For each Table, I need to make a history table with same structures. Now, I can use triggle to do it very well. My question it. Should I create another database named "ACCOUNT_HISTORY" , and create same table ??? or Should I create the table with pref...more >>

One Triggle rule or 3 triggle rules ?
Posted by Agnes at 10/27/2005 12:00:00 AM
Now, I create 3 separate triggle rules to save the copies of the record . However, I saw a sample which use 1 triggle rule to do it. and I found it will count the record first. My question is , Which design is better ? 1 triggle rule is easier to handle but it seems need more code to count re...more >>

ALTER COLUMN
Posted by Adam Knight at 10/27/2005 12:00:00 AM
Hi all, I am trying to alter a column with the following statement. Can anyone help me get the syntax correct.. ALTER TABLE asmt_v1_question_passed ALTER COLUMN pass_dt SET DEFAULT getdate() Cheers, Adam ...more >>

Update IDENTITY column. have way to do this?
Posted by ReTF at 10/27/2005 12:00:00 AM
Hi All, I have 2 tables, and these tables has one FK constraint, I would like know if have way to update the IDENTITY column of these tables, I did try this, but I receive one error. SELECT cartoes.numero FROM cartoes WITH(UPDLOCK) JOIN adicionais_cartoes ON (adicionais_cartoes.cartao = car...more >>

Export a table data in a script file
Posted by Man Utd at 10/27/2005 12:00:00 AM
How can I export a table data as a script file as INSERT statement from Enterprise Manager or Query Analyser ? ...more >>


DevelopmentNow Blog