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 > september 2004 > threads for wednesday september 22

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

sql performance
Posted by anand at 9/22/2004 11:45:03 PM
In the firm which i am working there is no dba as such so we are facing a big problem with the performance with sql server we have a table which contains lacs of records but when retrieving it takes too much time also ther are 4 to 5 indexes on that tables again adding a new index is a ...more >>

Derived Tables
Posted by anand at 9/22/2004 11:43:07 PM
can anyone help me out with derived tables will it be helpful for retrieving data a table of large no of records? is it possible to use derived table in the place of a temporary table ...more >>

query tooo slow
Posted by anand at 9/22/2004 11:15:03 PM
i have a table named sauda which contains more than 52 lacs of record the structure of the table is shown below if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SAUDA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[SAUDA] GO CREATE TABLE [dbo].[SAUDA]...more >>

SQL ORDER BY
Posted by Brian Andrus at 9/22/2004 11:15:00 PM
Ok, I am trying to get this to work: SELECT TOP 4 Address, ABS(Zip) - 90401 AS Expr1 FROM HotspotLocations ORDER BY Expr1 I think that it is evident what I want to get - the nearest 4 locations to the zipcode I will enter. The problem is that as long as I have that ORDER BY ...more >>

Selecting a column in same row as MIN()
Posted by Peter X at 9/22/2004 10:55:26 PM
Hi all, I have a Products table and a Prices table. There is a one to many relationship between Products and Prices as a single product may have multiple prices based on the quantity being ordered. CREATE TABLE Products ( product_id INTEGER IDENTITY (1, 1) PRIMARY KEY, produ...more >>

Having trouble using Order by when calling distinct
Posted by cyyu_tba NO[at]SPAM lycos.com at 9/22/2004 9:25:21 PM
What I wanted to do here is to optimize performance by using getstring. But I wanted same record to listed once and also listed in order as well. But this code result in error, I think the problem is to do with the item I use for order by doesnt get selected. I wonder how I could fix this? sS...more >>

help with query
Posted by Brian Shannon at 9/22/2004 8:25:09 PM
I have the following sample data and am wondering how to query it to get the below result. ID Month Value 1 2 100 1 3 100 1 4 200 1 7 300 2 1 400 2 2 500 2 6 ...more >>

master script to build database
Posted by John A Grandy at 9/22/2004 7:53:28 PM
i would like to build a master .sql file that builds up my database from scratch ... 1. runs various .sql files each which creates a table 2. runs a .sql file that creates various foreign keys 3. imports various .txt files into the various tables how to do this ? ...more >>



Connection.Mode=adModeRead fails?
Posted by SÁRINGER Zoltán at 9/22/2004 7:52:13 PM
Hi, vb6+mssql2000 i want to disable updates by set cn.mode=adModeRead. inspite of this, i can do modifications without error... any tip? what should i check? ...more >>

Variable problem
Posted by Hank at 9/22/2004 7:25:05 PM
declare @str varchar(50),@lev1 varchar(50),@lev2 varchar(50), ....,@levn varchar(50) set @lev0 = 'AAA' set @lev1 = '123' .... set @levn = 'BCD' declare @counter int set @counter = 1 while @counter < n begin set @str = '@lev' + cast(@counter as char) select @str set @counter = @counter +...more >>

returning seperate columns after using sum on multiple columns not working - novice question
Posted by Joey at 9/22/2004 7:23:47 PM
Hi There, I am trying to return the sum of qoh,s7days,sstd,rprice columns and the distinct value of colour,colourway,size but I'm not sure how to do it properly. I have tried using unions but It returns the data underneath the column I grouped the results by. is this possble to to in native sq...more >>

Using output variables
Posted by GeorgeP at 9/22/2004 6:57:40 PM
Hi All, I am trying to return a parameter to a web page thru an SP. I keep getting an error: Server: Msg 201, Level 16, State 4, Procedure GetPermissions, Line 0 Procedure 'Getlogins' expects parameter '@permission', which was not supplied. My Code is: Create Procedure GetPermissions ...more >>

IF @@Rowcount...
Posted by Chris at 9/22/2004 4:58:26 PM
I've a stored procedure which I changex a while back because I am convinced it was causing me problems. I've just come back to it and am trying to understand why I changed it and can't remember why. Here is what I used to have... SELECT Field1 FROM [MyDatabase].[dbo].[TableName] WHERE (...more >>

newbie query question
Posted by mmac at 9/22/2004 4:44:41 PM
I am new and struggling and dont know if this is even possible but here goes: How can I modify the following query to have the display show the number of items sold for EACH between a date range? The way it runs now is that I get a line for each item with the total sold between the dates. w...more >>

Scientific Notation in Import process
Posted by Robert Taylor at 9/22/2004 3:38:32 PM
I recently imported several thousand records from Excel files into our system but encountered a problem with Employee IDs. Our employee IDs are usually numeric in nature, but stored in nvarchar. Unfortunately during our import, we found that many of the employee IDs were converted to scientifi...more >>

Syntax error near keyword 'SELECT'
Posted by Mike Labosh at 9/22/2004 2:17:29 PM
SELECT @recordCount AS RecordCount, @contactCount As ContactCount, @matchedRecordCount As MatchedRecordCount, @matchedContactCount AS MatchedContactCount FROM SampleSourceProfiling I'm just not seeing it. All four variables are declared as INT, and have been assigned ...more >>

@@CPU_BUSY Questions / Possible Overlfow Issue
Posted by David Gugick at 9/22/2004 2:17:28 PM
I've read some posts on the Internet about a possible overflow condition that can occur using @@CPU_BUSY after the server has been up and running for a while. Some posts seem to indicate that the number of days hovers around 25, but I assume this number is related to the CPU activity on the serv...more >>

Separating Indexes and Data to 2 different physical drives
Posted by Rafael Chemtob at 9/22/2004 2:13:39 PM
Hi, I have a DB that is having some performance issues. I got a new machine that has 3 separate SCSI drives. I want to store the data on 1 drive, the transaction log on drive 2, and the indexes on drive 3. This machine is also a multip-processor machine. I need some assistance here. I want ...more >>

How to View Sal Server Stored procedure query
Posted by Syed Khurram Alam at 9/22/2004 1:57:40 PM
Hi All How to View Sal Server Stored procedure query after sending parameter any idea please help me ASAP I am using adobe Command object thanks from khurram ...more >>

Loop through tables looking at one particular column
Posted by Carl Gilbert at 9/22/2004 1:49:46 PM
Hi I am trying to loop through a series of tables and then in each table I wish to go through each recods, looking at the IsDeleted column of the record for occurances of 'True' I have 21 tables in one database. The DB is called ipvc_ee and each table begins with 'ipvc_ee_'. Examples...more >>

Finding out if a login exists
Posted by Carlos Galavis at 9/22/2004 1:40:56 PM
Hi, I need to write a SQL script to create a login in SQLServer and assigned some permissions to certain tables. I am using then "sp_grantlogin" stored procedure to create the login, but if the login happens to exist, the script fails with an error. I need to be able to determine if the login al...more >>

My problem with distinct
Posted by Carlo at 9/22/2004 1:30:52 PM
hi i need to select distinct on the first coloumn of a table of 2 coloumns SELECT DISTINCT id, num FROM #tmp this is my data, i need just 2 rows, one for EH and one for SH EH 32 EH 33 EH 34 SH 1 SH 2 SH 3 Thanks a lot Carlo ...more >>

Return x number of records starting at record y
Posted by Ryan Taylor at 9/22/2004 1:27:22 PM
Hello. I am writing an ASP.NET application and I am currently display a list of records. However, I want to display only X number of records and provide a paging mechanism so the user can step through the records. The user is also able to sort the records by any number of fields. How can I str...more >>

trigger result
Posted by Marcin Podle¶ny at 9/22/2004 1:22:31 PM
Hi all, My question is about triggers. I've procedure that inserts some records to the table. This table has trigger on itself. In my procedure I would like to check whether the trigger executed ok or wrong. I know that I can use Raiserror and Rollback inside the trigger but I'm looking ...more >>

Dynamic decimal?
Posted by Wade at 9/22/2004 1:17:36 PM
Hello all, I was wondering if the following is possible (this example doesn't work, but it should show what I'm looking for): declare @intScale int declare @intPrecision int set @intScale = 5 set @intPrecision = 3 select cast('3.3' as decimal(@intScale, @intPrecisi...more >>

Cant create/edit stored procs in VS.Net
Posted by Kyle Morris at 9/22/2004 1:08:15 PM
Hi All. The Visual Studio help says that I can use the Server Explorer to create/edit stored procedures. The example says to right click the server explorer database "stored procedure" node and a popup menu will enable the creation of a new stored procedure. When i do this - i only get "re...more >>

ntext in triggers
Posted by jdieter NO[at]SPAM twonails.com at 9/22/2004 1:05:12 PM
For an audit trail: I have to be able to acquire the new value and the old value for an ntext field that may be changed. It has to be done within a trigger. There is no way to get the data from ntext/image fields from within a trigger because it resides in the inserted/deleted tables. I a...more >>

Create a table from a join query..
Posted by Kendra at 9/22/2004 12:43:17 PM
Hello All, I am very new to the SQL world and I need to do something that I've found in pieces but I am not getting it put together correctly. We have 2 tables that I need joined together and exported to Excel. I can create a table, I can do the join, and I can export to Excel. How do ...more >>

flaw in tsql ?
Posted by Meinhard Schnoor-Matriciani at 9/22/2004 12:10:56 PM
Hi All ! Can someone please verify if it is just me or sql server ? select IsNumeric('-') returns 1, but select cast( '-' as numeric(3) ) gives me an error basically saying that it is not possible to convert from varchar to numeric. While select cast('-' as integer ) results i...more >>

count records in tables through information_schema
Posted by Samuel at 9/22/2004 11:54:23 AM
Hello, Does someone has a sql statement for me how to count the records in tables by using the view information_schema? I know that all view names are stored in information_schema, so i want to see how many records are in each table/viewname. Thnx ...more >>

Transaction Deadlock Problem with Triggers. I have no idea???
Posted by Ian at 9/22/2004 11:47:07 AM
Hi All Application Background: I have written an application that will have 10 users. It has 2 main function. To save and edit records in a MS SQL Server 2000 DB. And to read these record and use the information in them to perform actions. Each record is an individual instruction. The most im...more >>

Removing Trailing zeros another issue
Posted by Mark Vergara at 9/22/2004 11:12:51 AM
Hi! > > Please kindly help me on this, Is there any code of > removing the trailing zero's in sql just like for > example I have my data.. > > 89.890000 the output I would to see is 89.89.. > 89.00 the output I would like to see is the same as 89.00 > > and the data type is numeric 18,6...more >>

How to move from developer to DBA
Posted by PVR at 9/22/2004 11:08:05 AM
Hi sql gurus, Basically i am a developer working on vb.net/sqlserver I am working on sql server almost 2 years in the meantime i got very fascinated to sql server so i want to move to sql server dba. can you please guide me through your experiences.. how to move to dba. wat skills and...more >>

Table Ownership
Posted by A.M at 9/22/2004 11:05:28 AM
Hi, Is there any sql command that assign the ownership of all database queries to DBO? Thanks, Alan ...more >>

Programming Performance Counter
Posted by Ajay Kumar at 9/22/2004 11:04:04 AM
Hello everybody out there i looking for information regarding the performance monitoring of sql server.. what is required to do is to find the No of Transactions per day for a particular database. what i know is that there are @@trancount system variable and tool available in OS like Perform...more >>

Stored procedure - permissions
Posted by John J. Hughes II at 9/22/2004 10:50:41 AM
Ok I have a zillion stored procedures with meaningful names, wow! I can now set user level permissions, double wow! Ok there does not seem to be a easy way of doing this in the enterprise manager. The base way I have found is to open the user name and then click each stored procedure "exe...more >>

CSV Question!!
Posted by Vai2000 at 9/22/2004 10:42:03 AM
Hi All, I have a procedure in which I am doing an operation create procedure foo (@csv varchar(1024)) as SELECT * FROM <tbl> where <col> not in (@csv) Returns error!!! I was wondering can we do the above operation TIA ...more >>

How to update a table's contents
Posted by Goober at 9/22/2004 9:48:07 AM
I have a table that contains anywhere between 4-5 years worth of data. Basically, it's soldto, shipto, dc info on it. One problem I've run into, is that over time, the dc field has changed from one thing to another on the source tables (the table I have is built from 4-5 others). For some c...more >>

Locks?
Posted by Justin Drennan at 9/22/2004 9:21:33 AM
I have a SQL server running on a SAN, and 16gigs ram. Every morning the machine runs out of locks - how would you recomend I go about sorting this out? ...more >>

Converting Flat File format to relational
Posted by Robert Taylor at 9/22/2004 9:13:21 AM
I have been tasked with importing about 8 different Excel files into SQL. Due to the typical Excel methodology, the user added columns where we would need the data in multiple rows. Of course I can write my sql to extract the columns using something like select ID,column1 from Excel UNION ...more >>

Subtract a day?
Posted by Mike at 9/22/2004 8:52:15 AM
Can anyone tell me how to modify my query to subtract one day from the "and left(a.dateentered,11)= Left(getdate(),11)" line? Thanks! SELECT type, a.clmno, batchnumber, returned, a.dateentered FROM dukeaccount..tbledipporepricingtracking a join dukeaccount..clh b (nolock) on a.clmno ...more >>

Setting identity column on query
Posted by Oded Kovach at 9/22/2004 8:49:47 AM
Hello there I have query that runs on sql On that query i would like to create an identity column How can i do this? ...more >>

Failed Jobs
Posted by Justin Drennan at 9/22/2004 8:19:51 AM
When a job fails, where do I view the failure reason ? ...more >>

deadlock when reading most currently inserted records
Posted by RJ at 9/22/2004 8:03:20 AM
I have pair of batch processes continually and concurrently accessing the same table. One is doing inserts of "unprocessed" records, the other is selecting these freshly inserted "unprocessed" records. Immediately after each select, the records in the result set are updated as "processed", using...more >>

Please help with trigger
Posted by paulsmith5 NO[at]SPAM hotmail.com at 9/22/2004 6:28:09 AM
Hi, Please could somebody help with the following. I have a table which contains information on a list of tables within my database. These tables are created at runtime by my desktop application. I want to know if its possible to create a trigger on this table so that in the event of a row be...more >>

Wildcard in restore script
Posted by rew at 9/22/2004 5:50:44 AM
Hi, I need to restore a test database everyday with fresh data from a production inviroment. My problem is that I want to restore the backupfile created with the maintenanceplan. But this backup file has a filename who changes every day beacuse sql puts " _db_yearmonthdaytime " in the ...more >>

Problem while exec Script
Posted by Akash Uday at 9/22/2004 5:19:25 AM
Dear Experts I am running following Query from SQL 2000 UPDATE [14.15.93.25].[CORPDB].[DBO].[ItemMaster] SET ItMas_IsReffered = 1 FROM [14.15.93.25].[CORPDB].[DBO].[ItemMaster] INNER JOIN ItemMasLocal ON ItMas_Id = IMM_MasId Go While Executing It is giving me following error "...more >>

Importing & Primary key
Posted by Paul in Harrow at 9/22/2004 3:39:06 AM
Hi there, I have a table that includes the fields: UserName, Title, CourseCode (all varchars) EventNum (smallint) & EventVal (smallmoney). The primary key is a combination of UserName, Title & CourseCode, EventNum is a number up to 99 and EventVal is Cumulative (ie if Event 1 = £50 and Eve...more >>

stored procedures using transactions
Posted by Mike P at 9/22/2004 1:33:00 AM
I'm trying to write my first stored procedure using transactions. First of all, can anybody tell me if I am going about it the right way, and secondly, if I need to return the result of the transaction to the calling application (C# in this case) would I just declare an output parameter and set...more >>

Problem while executing query
Posted by Akash Uday at 9/22/2004 1:12:49 AM
Dear Experts I am running following Query from SQL 2000 UPDATE [14.15.93.25].[CORPDB].[DBO].[ItemMaster] SET ItMas_IsReffered = 1 FROM [14.15.93.25].[CORPDB].[DBO].[ItemMaster] INNER JOIN ItemMasLocal ON ItMas_Id = IMM_MasId Go While Executing It is giving me following error "...more >>

Trigger not quite right
Posted by jez123456 at 9/22/2004 12:39:02 AM
Hi gang, I’ve almost got this working but not quite. Maybe I described the problem incorrectly. Here is the code to produce and populate my test table CREATE TABLE [tblEntitlement] ( [strLogonName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [intYear] [int] NOT ...more >>


DevelopmentNow Blog