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 wednesday october 26

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

Keeping track History Maintainance--Design Issue
Posted by thomson at 10/26/2005 9:53:47 PM
Hi all, i do have a new module named as Project Costing, in which i have to create a Heirarchy of Activities, Some thing of this sort Project |---Phase1 |--Stage1 |---Phase2 |---Stag...more >>


Server Side Include
Posted by mt at 10/26/2005 8:45:02 PM
Hi Friend, I am new to ASP with SQL 2000 connection. I need to use Server Side Include file for connect SQL 2000 using VBScript. According to my project, I will connect from my asp page to that include db file using function. I am using ODBC DSN. If you have Server Side Include sampl...more >>

Grouping and counting
Posted by gv at 10/26/2005 7:16:05 PM
Hi, I will try to explain: I want the proper grouping and display counts. This query works fine, see below some of the returned results. SELECT TempD.state, TempD.City, TempD.Zip, count(TempE.ID)AS total FROM TempE INNER JOIN TempD ON TempE.N...more >>

concatenate - maybe?
Posted by shank at 10/26/2005 6:22:43 PM
I'm not sure what this process would be called. I've got 2 columns... [A] = FamilyName [B] = FamilyMembers I'm trying to make this... [A] [B] Doe Alan Doe Bob Doe Betty Doe Joe ....into results like this... [A] [B] Doe Alan, Bob, Betty, Joe i.e. Group c...more >>

Select for lower case
Posted by Patrice at 10/26/2005 6:20:02 PM
Hi, I am trying the following (what should be easy), select and I don't seem to get the correct results - I am getting some upper case results as well: select identifier FROM WHDATA1.DBO.ENDORSEMENT WHERE WHDATA1.DBO.ENDORSEMENT.POLICY_NUMBER = STAGE_PHX_FACT_POLICY_AP.POLICY_NUMBER AN...more >>

Insert thru a view to a table with an IDENTITY property
Posted by Dave at 10/26/2005 5:48:02 PM
Why doesn't my identity property function normally when I try to insert through a view? --I create base table with identity property CREATE TABLE _t (id int identity ,num int) --then insert a value INSERT _t(num) VALUES (1) --create view on base table CREATE VIEW t AS SELECT * ...more >>

Grouping problem
Posted by tshad at 10/26/2005 5:47:01 PM
I am trying to get a table to display where my like rows would sum together, but now matter how I do it there are 2 rows (in my example) that always show as separate rows and I want to combine them. For example: ProductName Balance 30 60 90 -------------------...more >>

Changing Column Length
Posted by XXX at 10/26/2005 5:00:28 PM
I have a table which gets it feed from external source. I need to chnge the length of the column on DBs which are in Prod. The table has couple of indexes and FK relationship (NOT on the column that I need to change). Number of records is around 36 million. I have never done something like t...more >>



Consolidate records
Posted by Terri at 10/26/2005 4:17:24 PM
I consider security A to be equivalent to C so I want to consolidate these positions. Three scenarios: If an account holds both A and C I want to add the C quantity to the A position and delete the C position. If the account holds A but not C then no action. If the account holds C but not...more >>

NEWBIE: DATE Problem
Posted by Randy at 10/26/2005 4:00:55 PM
Hello NG How can I use a variable for datetime in a where clause. DECLARE @varDT AS DATETIME SELECT @varDT = x.TESTDT FROM(SELECT TOP 1 [LabelDateTime] AS TESTDT FROM TABLE1) Records Actually Total 6 Tried: SELECT COUNT([LabelNumber) AS TESTLC FROM TABLE1 WHERE [LabelDateTime]=@v...more >>

Too many tables
Posted by Jchbd at 10/26/2005 3:53:01 PM
Hi.. I am a new programmer and inherited an application that has over 200 + tables. Does anyone know a quick or simple process to determine if a table has been utilized recently? Trying to avoid going through each SP and report. Would the diagramming tool work ? appreciate it! -- ...more >>

Replace function and remove some string in column
Posted by gv at 10/26/2005 3:51:13 PM
Hi all, I'm trying to search in a column and remove a comma and what comes before it. like this: AL, Alabama FL, Florida then should look like this Alabama Florida trying to use the replace with wild card but doesn't seam to work? Any id...more >>

Persistence of Time... DateTime bugs, that is
Posted by Chris Durkin at 10/26/2005 3:45:07 PM
Guess what? The DateTime rounding bug never got fixed in SQL Server 2005. You know, this one: SELECT CAST('10/25/2005 23:59:59.990' AS DATETIME) AS [990] SELECT CAST('10/25/2005 23:59:59.991' AS DATETIME) AS [991] SELECT CAST('10/25/2005 23:59:59.992' AS DATETIME) AS [992] SELECT CAST('10/25/...more >>

Problem with linked servers
Posted by Kevin Eckart at 10/26/2005 3:40:59 PM
I have two servers that are linked together ServerA and ServerB. I can do selects from remote tables on both servers with no problems. The problem that i am running into is when I am doing an insert into a local table via a join with a local and remote table. Both Win2k3 server with SQL 200...more >>

Question
Posted by Abram at 10/26/2005 2:37:24 PM
We have an ODBC application running a query that runs much slower through our app than in SQL Query Analyzer. Is SQL Query Analyzer using ODBC to connect to SQL Server? If not, what technology is it using? Thanks in advance, Abram ...more >>

primary keys
Posted by Jason at 10/26/2005 2:17:15 PM
Hello, I've a problem setting up a constraint on a table. There are two primary keys in that table and one of them will be filled in through an access application, wether it be nothing or some integer value. What i want to do is to set a zero-value in a primary key column, how can i d...more >>

Case statement error
Posted by DBA at 10/26/2005 1:55:04 PM
I have an sp that I am trying to run, but it keeps failing. Something like this if a.one='PA' then begin select * from a else select * from b end I keep getting errors. I have tried a CASE statement, but it does not seems to work...more >>

how to know a column was indexed or not ?
Posted by joy.net at 10/26/2005 1:51:24 PM
hi iam a csharp developer . the problem is i don't know how to select in systables of sqlserver ...more >>

How to know a column whether indexed or not in sql2k
Posted by joy.net at 10/26/2005 1:39:16 PM
i'll be appreciated any help ! ...more >>

Cannot resolve collation conflict for equal to operation.
Posted by dotnettester at 10/26/2005 1:31:05 PM
Hi, I am getting this error while trying to join two tables on two different databases. How can I find out the collation on each and how can I make them similar? Plz help. Thnx in advance...more >>

sp with parameters
Posted by JFB at 10/26/2005 1:24:08 PM
Hi All, I'm working in a sp to get info from a users and companies table but I'm passing parameters for my where validation statement. CREATE PROCEDURE GetCustomers @searchKey varchar(50), @filter int AS select co.companyname, s.statusdescription, isnull(u.usermiddlename, '') as userm...more >>

How to take data out of table, restructure the table and then put the data back in
Posted by Laphan at 10/26/2005 1:21:52 PM
Hi All Wonder if you could help, I have a bog standard table called STOCKPRICES that has served me well for a while, but now I need to change the structure of it and because a number of users have used it in it's present form I need to so the following in SQL script: a) Grab a snapshot o...more >>

Check if Delete ran in a trigger
Posted by Altman at 10/26/2005 1:08:53 PM
I am new to SQL Server and I am trying to write a trigger where I am doing a delete on another table. I need to know whether this delete fails or not. How can I achieve this? -- TIA Altman ...more >>

Help with INSERT INTO
Posted by tony NO[at]SPAM acslhome.com at 10/26/2005 12:31:21 PM
I have one table of products: create table XPRODUCTS (prod VARCHAR(4)not null, pdesc VARCHAR(30), x1 INT, x2 INT, x3 INT, x4 INT) and another table of items: create table ITEMS (itemno VARCHAR(4) no null, descr VARCHAR(30), price1 INT not null, price2 INT not null) XPRODUCTS is created v...more >>

Entering maintenance mode through Enterprise Manager?
Posted by Neil W. at 10/26/2005 11:37:35 AM
Is there a way of entering maintenance mode ("-m") through Enterprise Manager (2000), rather than running sqlservr.exe directly? Thanks! ...more >>

Primary Key Datatypes
Posted by John at 10/26/2005 11:27:03 AM
What are the most effeicent primary keys? Is a Varchar or binary datatype bad for a primary key? ...more >>

how to know a column was indexed or not ?
Posted by joy.net at 10/26/2005 11:15:34 AM
hi iam a csharp developer . the problem is i don't know how to select in systables of sqlserver ...more >>

cast datetime to yyyymm format
Posted by Matt at 10/26/2005 11:13:05 AM
How can I cast a datetime to a format of yyyymm? firstdate and seconddate are both datetime fields and I want to use them in the yyyymm format in my where clause below. Declare @curdate datetime Set @curdate = 2005/11 select firstdate, seconddate from dates where @curdate between ...more >>

Convert
Posted by Brennan at 10/26/2005 10:55:07 AM
I am using the following snippet of code to help me convert the date and time in a query I am writing. SELECT dbo.Users.FirstName + ' ' + dbo.Users.LastName AS Student, dbo.Subjects.Subject, Convert (Char(15),dbo.TrainingSchedules.RequestedDate,101) AS Date, Conv...more >>

Stop Error Messages?
Posted by Saul at 10/26/2005 10:36:35 AM
Hi all, I have a somewhat unusual circumstance. I am submitting several stored procedure calls in one statement (from a remote handheld device, as it happens, using an rda.SubmitSql command - it's a LOT faster than sending them one at a time, so this can't change) to an MS SQL 2000 database...more >>

capturing dynamically returned integer
Posted by len at 10/26/2005 10:36:01 AM
Hello there. I have a dynamic SQL query (I had to use it - I swear!) that returns a single integer value. However, I'm having trouble capturing the value in a local variable. Any ideas what I should do with my syntax (to get it working I mean...)? declare @SQLQuery nvarchar(1024) declar...more >>

Query/SQL help
Posted by Joe O at 10/26/2005 10:34:59 AM
I have two tables Table1 Item# -Descr-Amt xyz1- Orange - 250.00 xyz2 - Apple - 350.00 Table 2 Item#-Tax-Amt xyz1-Tax1- 2.50 xyz1-Tax2-3.50 xyz2-Tax1-3.00 xyz2-Tax2-4.20 I will like have a query to show data as Item#-Descr-Amt-Tax1-Tax2 xyz1-Orange-250.00-2.50-3.50 xyz2-Apple-3...more >>

Is there any new feature on SQL Server 2005 for paging result?
Posted by ABC at 10/26/2005 10:27:29 AM
We are web developer. The paging features of SQL Server providing will great to improve the development time. Is there any new features on SQL Server 2005 for paging? ...more >>

Database backup from ADP application
Posted by Ben at 10/26/2005 10:02:05 AM
if it is possible, how would i go about creating routines (storedprocedures?) that can be invoked from a microsoft access ADP file that will backup (and hopefully have the ability to also restore) as SQL Server database? thanks for any and all help! ben...more >>

Help with Normalizing table
Posted by Drew at 10/26/2005 10:01:57 AM
I am upgrading an Access DB to SQL Server. I have a table in the database that looks like this, tblContacts RegNo - Primary key Name Relationship Phone WorkPhone Name2 Relationship2 Phone2 WorkPhone2 Name3 Relationship3 Phone3 WorkPhone3 Name4 Relationship4 Phone4 WorkPhone4...more >>

counting records
Posted by Tony at 10/26/2005 10:01:45 AM
Hi all, I have a DTS package that gets information out of a Pervasive db and drops it into SQL. I need a count on how many distinct loan number are associated with specific actions (ie Closing Date, Funded Date etc). I have 2 tables: 1 contains a reference number and description (ie 170 ...more >>

HOW DO I: Group by Month
Posted by Owen Mortensen at 10/26/2005 9:40:04 AM
I have a table that I need to sum up grouped by month. However, every day of the month is there. Here's thy SQL to build the table: CREATE TABLE [dbo].[asr_article_views] ( [id] [int] IDENTITY (1, 1) NOT NULL , [log_date] [smalldatetime] NULL , [sec_id] [smallint] NULL , [sub_id] [small...more >>

GROUP BY!
Posted by Arpan at 10/26/2005 9:13:49 AM
SELECT MIN(Salary) FROM ( SELECT TOP 10 Salary FROM tblEmp ORDER BY Salary DESC) AS X As such the resultset of the above query will only have the record of the Salary column. I want the record of another column named EmpName as well in the resultset. So where do I accomodate the 'GROUP BY EmpN...more >>

creative ideas on problem needed
Posted by AshleyT at 10/26/2005 9:11:04 AM
Hello! I am looking for creative ideas to the following situation. Currently I receive multiple .dbf files coming in from multiple locations at the end of the day. I then use DTS to bring those files into their appropriate tables in a sql database. However, now we would like to get the i...more >>

Capture Execution Time Then Rollback Transaction
Posted by Joe K. at 10/26/2005 8:38:05 AM
I would like to execute a stored procedure listed below then capture or print out the execution time. Lastly rollback the transaction so that data does not change in the database. dbo.usp_Manual_toTraint 65823,'2004-08-01','TA_BB','2004-09-01' Please help me with this procedure. T...more >>

is there a way to do this
Posted by rodchar at 10/26/2005 7:35:09 AM
Hey all, I have this value in a field: 0.I.3.* Is there a way to make the above like the following: 1.I.3.* I have a lot of records that need this change. thanks, rodchar...more >>

T-SQL String manipulation
Posted by Andi at 10/26/2005 5:36:20 AM
Hi, I am new in T-SQL and I am trying to transform a personal number to a special format. I am using DTS to import two tables into SQL Server. One table has the personal number format, that the number is every time 8 digits long e.g. 00000001. Another table has the same number in the format 1...more >>

"select TOP" with parameter...
Posted by len at 10/26/2005 3:45:05 AM
Hi there. Does anyone know of a way to get the following statement to work without using dynamic SQL?...... I'm trying to get a "select TOP" to work while passing in a parameter as 'N' for 'select the first N rows...' declare @NumberofRecords integer select @NumberofRecords = 5 sele...more >>

Help with Multiple inserts
Posted by hals_left at 10/26/2005 3:32:09 AM
HI, How do I rewrite the first query using the datafrom query 2 so that I can do multipe inserts for all the units given this input: @EnrolmentID, @dteEnroled, @Outcome, @CourseID -- 1. This creates one unit enrolment using parameters INSERT INTO tblUnitEnrolment (EnrolmentID,Enrol...more >>

sp causing fatal exception
Posted by Erik at 10/26/2005 3:28:04 AM
Hi all, I have a problem but am not certain if it is a server och programming question. The post is going to be rahter long... Anyhow, this is the scenario Setup: Sql2000ent sp3a, failover cluster, 2nodes Involved procedures and tables TABLE Applikationer CREATE TABLE [dbo].[applikatio...more >>

Ad-hoc query builder for non-techie users
Posted by Levent ORER at 10/26/2005 2:28:04 AM
Hi, is there a SQLServer utility or tool to equip regular non-techie users with the ability to create, run and save their own reports? That would be similar to the Webintelligence product of BusinessObjects: It's basically a graphical drag&drop tool for creating SQL queries with "more Englis...more >>

Where 1=1
Posted by Yama at 10/26/2005 12:52:04 AM
Hi, I have heard that writing: SELECT FirstName, LastName FROM Customers WHERE 1=1 instead of: SELECT FirstName, LastName FROM Customers speeds up the response to get back records from the database. Is that true or just a myth? Thanks, ~yamazed ...more >>

Joe Celko in error?
Posted by kurt sune at 10/26/2005 12:00:00 AM
Found an article today: http://www.dbazine.com/ofinterest/oi-articles/celko14 Tryed it in SQL server, doesnt work due to the fact that SQL server doesnt treat count as sum. This query gives the wrong answer, the usage of count taken from the Celko-article. SELECT COUNT(CASE WHEN x0 = ...more >>

Error with COUNT(CASE WHEN...)
Posted by kurt sune at 10/26/2005 12:00:00 AM
I have a strange problem. I have reduced the problem to this: SELECT COUNT(CASE WHEN x0 = 'A' THEN 1 ELSE 0 END) AS a_tally ,COUNT(CASE WHEN x0 = 'B' THEN 1 ELSE 0 END) AS b_tally FROM (SELECT 'A') AS X (x0) I exppect this to give me the result a-tally = 1 and b-tally = 0. Ho...more >>

Trigger rule or SP -update & insert question
Posted by Agnes at 10/26/2005 12:00:00 AM
I got two same tables (invoice, invoice_history) When user insert the record, (i will save a copy in the table invoice_history) when user amend the record, (i iwll save the updated record in the table invoice_history_too) Now, I am worry that I don't know how to do that by trigger rule. If i...more >>

What is wrong with this WHERE clause
Posted by David P via SQLMonster.com at 10/26/2005 12:00:00 AM
The Where clause is below. The data I am pulling has 4 fields with numbers in them. These 4 fields do not contain NULL values. I am trying not to pull a record if all 4 fields are zero but my query does. where GLBA.CODE_COMBINATION_ID = GLCC.CODE_COMBINATION_ID And GLCC.SEGMENT4 = VW...more >>

ADO Performance question
Posted by Pushkar at 10/26/2005 12:00:00 AM
Hi, I am writing a code which is actually performing multiple inserts on a = table. Currently I am combining all my insert queries and passing as command = text to ADO command object. There is one more way by opening a recordset and call AddNew on = recordset multiple times and then batch up...more >>

Two Queries, which one is better?
Posted by Chris at 10/26/2005 12:00:00 AM
We have a column called Commission that is derived by using the mathmatical expression ISNULL(ROUND(Price * CommissionPercentage / 100, 2), 0). This column then needs to be referred to by other columns within the query. E.g. I need to work out CommissionTax and CommissionTotal CommissionTa...more >>


DevelopmentNow Blog