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 > february 2005 > threads for monday february 28

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

Want to store chinese characters properly in database
Posted by manisha_css at 2/28/2005 9:43:03 PM
I am working on MS SQL 2K and Java as backend. I want to store unicode data that is coming from form HTML page. The problem is the data that is getting stored to the database is ቅቚ etc instead of the correct letter value. I have declared the filed type as nvarchar. Pls pls help me, stuc...more >>


would a Stored Procedure help
Posted by Brian Higgins at 2/28/2005 7:21:48 PM
I have a large and ever growing database with over 15 million records, all timestamped, and increasing by roughly 30,000 records per day so efficient queries are essential. I need to pull a list of records that match certain criteria, that have timestamps in the last hour. and I need to run...more >>

Query problem
Posted by ALI-R at 2/28/2005 7:09:54 PM
I have three tables as follows: Table1: ClientID StudentID Name ---------------------------- 1 22 John 2 23 Chen 3 34 Ted 4 22 Bod Primary Key=ClientID + StudentID Table2: InternalID Cli...more >>

permission denied on object 'sp_sdidebug', database 'dbname',
Posted by Jeff Kish at 2/28/2005 6:38:03 PM
Hi. I have seen lots of discussion. My starting problem was that after installing sql server 2000 and sp3, I could not debug stored procedures. I thought I saw the solution in MSDN, but it did not work for me (I could not grant execute on sp_sdidebug to my user). short end is.. I had to...more >>

Triggers to update table across servers
Posted by culam at 2/28/2005 5:37:05 PM
I have this table that contains multiple messages in serverA. I need to update the similair messages on serverB if messages on serverA is updated. ServerA select memb.memberNo, memb.sub, omsg.comment1 + ' ' + omsg.comment2 + ' ' + omsg.comment3 + ' ' + omsg.comment4 + ' ' + omsg.commen...more >>

Import and Export foreign characters (non-DBCS only)
Posted by Imtiaz at 2/28/2005 5:01:01 PM
Hi I have a table which stores the customer information....There is a Customer Address column defined as nvarchar(50)....Data for the table is imported using DTS Bulk Insert from a Customer.dat file.... My question: - 1. What are the requirements for me to view the foreign characters (A...more >>

question about database design
Posted by Utada P.W. SIU at 2/28/2005 5:00:24 PM
I have a table, named car. It normally have 10000 records and will growth in the furture. Administrator can delete the car record through an web based administrator platform And we not like delete the car record physically. My question is that, what is the best method to keep the database ...more >>

Select Query Question
Posted by AST at 2/28/2005 4:51:40 PM
Hey, I have a need to query on 2 tables as follows: SELECT Table1.*, Table2* FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID What I need to be able to accomplish is to return the rowset that includes only ID's that have the same ParamID specified more than once (> 1) in [Table2]. ...more >>



SQLServer dosn't throw warning message !
Posted by M.Sauve at 2/28/2005 4:50:13 PM
Hi All When I create stored procedures that reference missed object I have noticed that my SQLServer dosn't throw the warning "Cannot add rows to sysdepends for the current stored procedure because it depends on the missing object ...." Is there any witch to turn ON in order to have this mess...more >>

error with OpenRowSet
Posted by .bill at 2/28/2005 4:33:26 PM
I'm trying to import a simple excel spreadsheet into MSDE using = OpenRowSet, but receive the following error: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. =20 Connection Closed here's the sql: select * into MyTable FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',=20 'Exc...more >>

insert statement
Posted by Jason at 2/28/2005 4:31:26 PM
Hello, I'm trying to insert into another table where select clause contains a join with another table. However the number of columns of the source does not match with the destination table. How can i fix this without specifying all columns? ...more >>

Generating SQL Script
Posted by Roy Goldhammer at 2/28/2005 4:03:48 PM
Hello there I have huge database on sql server. The database probide tables, views, store procedures and functions Some of the views or the store procedures are depend on the functions, store presedures are depend on the views. When i update the version I generate SQL Script and run it on...more >>

Two Foreign Keys on one column - problem
Posted by Geni at 2/28/2005 3:48:17 PM
Hi, I have a problem. My problem is : I have two tables reprezentoing a tree, first table representing nades, and second representing links first - ID, Name second- ID1, ID2,weight --------------------- ---------------------- | 1 | name 1 | | 2 | 1 | 6.0 | | 2 | n...more >>

xp_cmdshell at start-up time
Posted by Ramon Moliner at 2/28/2005 3:40:39 PM
Hi everybody, We have an stored procedure at master database that runs when SQL Server starts up (exec sp_procoption N'sp_ICarDMSStartup', N'startup', N'true'). This stored procedure calls xp_cmdshell for retrieving hard disc information: INSERT #xpoutput EXEC master.dbo.xp_cmdshell "di...more >>

Return Code from Stored Proc
Posted by Robert at 2/28/2005 3:37:05 PM
I am doing an insert with a stored proc using the ExecuteNonQuery in the DataAccess Block from Microsoft. My parameters are inserted correctly into the database but my return code is always a -1 instead of 0. Please review this code and tell me if you see something I am doing wrong> Thanks ...more >>

How to get around row size limitation
Posted by moondaddy at 2/28/2005 3:25:56 PM
I have a table which has a number of large notes columns where users sometimes need to record several pages of notes for each column. So if I have 2 columns each varchar(4000) then at times the row size will exceed its 8k limit and nasty problems will occur. How is it that people are able to...more >>

Subselect with multiple values
Posted by MEG at 2/28/2005 3:19:03 PM
I have a medicationtable that looks like this: Acct Medication Active 1 Drug 1 Y 1 Drug 8 Y 1 Drug 9 Y 2 Drug 1 Y 2 Drug 3 Y 3 Drug 1 ...more >>

Sum of Sum from 2 tables
Posted by ericvdb at 2/28/2005 3:01:19 PM
hi all i have 2 tables with identical columns. How can i get a sum of the 2 tables: select sum(QTUM1) as pieces, sum(QTUM2) as volume, sum(QTUM1O) as [Pieces free], sum(QTUM2O) as [Volume Free], sum(FATTM) as Invoiced from stat001f where (myYear = 2004 and myMonth = 9) select sum(QTUM1) a...more >>

DataBase reusability
Posted by W. Jordan at 2/28/2005 2:31:17 PM
Hello, I am developing several database centric applications. Each application has gotten one or more databases. I discovered that some applications share some functionalities around database tables. For example, Application A will query the Members, Groups, MemberPreferences tables in datab...more >>

osql return to check backup success/failure
Posted by ishaan99 via SQLMonster.com at 2/28/2005 2:07:32 PM
I am running an osql using input script which runs a database backup. Is there a way I could get a return of 1 or 0, 0 being success and 1 being error. I tried using -b option but it returns the entire details of failure followed by the return number and if i use -o paramater I dont see any resu...more >>

Elaborate on a query
Posted by Peter Newman at 2/28/2005 1:31:04 PM
SQL 2000 Current Query SELECT YEAR(T1.RecievedDate) AS 'YEAR', DATENAME(MONTH,T1.RecievedDate) AS 'MONTH', COUNT(T2.LedgerKey) as 'COUNTS' FROM BacsHdrYearly AS T1 JOIN BacsTrnYear AS T2 ON T1.LedgerKey = T2.LedgerKey GROUP BY YEAR(T1.RecievedDate), ...more >>

Better way to do this query
Posted by JP at 2/28/2005 1:24:08 PM
Is there a better way to do this query? I was hoping to do it with a CASE and IF... SELECT TOP 100 PERCENT CustomerNumber, InvoiceNumber, InvoiceDate, DocType, AgingBucket, CASE WHEN DocType IN (6,7,9) THEN -1 ELSE 1 END * CASE WHEN AgingBucket = 1 THEN Amount ELSE 0 END AS '...more >>

SYNTAX ERROR in Stored Procedure
Posted by pmud at 2/28/2005 1:23:11 PM
Hi, What's wrong with the following stored procedure? CREATE PROCEDURE [dbo].[usp_Status] (@Status varchar(30)) )AS if(@Status= "Open") { select * from INVOICES where OPEN_STATUS="T" } else if (@Status= "In Process") { select * from INVOICES where INPROCESS_STATUS="T" } ...more >>

SYNTAX ERROR in stored procedure
Posted by pmud at 2/28/2005 1:23:11 PM
Hi, What is wrong with the following stored procedure? CREATE PROCEDURE [dbo].[usp_Status] (@Status varchar(30)) )AS if(@Status= "Open") { select * from INVOICES where OPEN_STATUS="T" } else if (@Status= "In Process") { select * from INVOICES where INPROCESS_STATUS="T" } ...more >>

deadlocks when fetching
Posted by Erik Knudsen at 2/28/2005 1:19:32 PM
Hi! We are developing cgi applications, using ODBC and (among else) MSSQL. Now we are experiencing deadlocks on MSSQL only, and the problem is - they occur not when the query is submitted, but when rows are fetched. We don't use transactions with several statements, so basically every que...more >>

Get rid of leading 0s of a varchar field
Posted by Ed Chiu at 2/28/2005 1:13:02 PM
Hi, I have a field called StreetNo in a table called Prospects, the field is a varchar(10). The table is populated by someone else, so I have no control over what kind of data entered into the table. The StreetNo I got is a complete mess, e.g. 00001, 01234, 01234a, 0000 PO Box. Is there a...more >>

Update current row(s) from previous row
Posted by Kurt Schroeder at 2/28/2005 1:09:13 PM
I need to update a current row(s) from a previous row(s) the keys are CSIID and CSIDATE If i want to update all rows for today from the values from yesterday i would need to match the csiid = csiid and check for the dates Would it be Update [todays rows] where [todays rows].date = toda...more >>

Number of duplicate record
Posted by Aaron at 2/28/2005 12:55:15 PM
I need help writing a query that can tell me the number of records with the same content. For example, this is my database (Data1 only has 1 column) Table Data1 Column numbers 234 322 2323 234 453 234 412 2323 ----------- the query should like something like this Select ...... From...more >>

Adding bit fields
Posted by David C at 2/28/2005 12:47:46 PM
I tried to add 7 bit filelds together but it failed. I have 7 bit fields to indicate days of week that person works, e.g. Mon, Tue,.....Sun and want to add them together to come up with # days worked in a week. I was trying [Mon]+[Tue]+[Wed].......+[Sun] but it failed. Is there any easier w...more >>

I need a slow query!
Posted by Kristoffer Persson at 2/28/2005 12:35:49 PM
For testing purposes I would like a query that is configurably slow. Like a mathematical query with a maxcount variable... Any hints? - Kristoffer - ...more >>

writing audit trail for a table
Posted by Sa at 2/28/2005 12:15:05 PM
Hello Experts, I am using SQL Server 2000 (SP3). May I ask you a question regarding programming in SQL Server? I have an "Opportunity" table (more than 30 fields with various data type) and an "AuditTrail" table. Whenever there is an update action to one or more fields in the "Opportunity...more >>

Need Max date?
Posted by DaveF at 2/28/2005 12:08:44 PM
Here is what I have so far: SELECT DISTINCT SPEEDLOCATIONS.HWY, SPEED.SPEEDMPH, SPEED.DATETIME, SPEEDLOCATIONS.[CROSS] FROM SPEEDLOCATIONS INNER JOIN SPEED ON SPEEDLOCATIONS.ID = SPEED.ID WHERE (SPEEDLOCATIONS.CITY = 'HOU') ORDER BY SPEEDLOCATIONS.HWY, SPEEDLO...more >>

disable/enable all SQL Agent jobs in a non cursor approach
Posted by Hassan at 2/28/2005 11:53:29 AM
Is there a way to disable/enable all SQL Agent jobs using a set based operation as opposed to a cursory approach that i can think of right now If so, can one provide the SQL for it ...more >>

Indexed View
Posted by Jaco at 2/28/2005 11:35:11 AM
Hi I am trying to create a indexed view. This view will run on Standard Edition Server so I have to use the WITH (NOEXPAND) option. However I am getting the following error - Server: Msg 8171, Level 16, State 2, Procedure ActionList, Line 4 Hint 'noexpand' on object 'dbo.Action' is invalid. ...more >>

Recovering using the transaction log
Posted by Earnie at 2/28/2005 11:09:05 AM
I have a database hosted on a comercial web server I can access it using SQL server Entreprise Manager I have never backed the database up though i copy it regularly. Exactly how do you recover the database to an earlier point using the Transaction Log and can it be done to recover 'Dropped'...more >>

output user and group membership from Active Directory
Posted by === Steve L === at 2/28/2005 10:43:11 AM
background: sql2k and active directory, using windows authentication. I'm wondering if anyone has done this successfully in the past and is willing to share the how to... pretty basis stuff, just a list of users and the windows group they belong to, something like... user1 group 1 user1 ...more >>

Using a view in an SP which has a specific sql user
Posted by Andy at 2/28/2005 10:39:54 AM
Hi, I'm writing sproc based on server A, which during processing needs to create a select statement with a join from a view on server B. I only have access to the view on server B through use of a specific sql login, which I obviously also have the password for. The sql login and password o...more >>

Over-ride a trigger
Posted by Roger Twomey at 2/28/2005 10:29:16 AM
I have a table which, until now had an update trigger only. That trigger was used to record the record as it existed BEFORE the change, and who made the change. It works fine. Now I have a situation where a program will INSERT a row into the table (which now has a new field). The value of ...more >>

Restore Database problem
Posted by Richard at 2/28/2005 10:22:46 AM
Hi Gurus, I am doing Backup and Restore. But while restore it restore from the previous backup. What am I doing wrong. BACKUP DATABASE TestDB TO DISK = 'c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\TestDB.bak' RESTORE DATABASE TestDb FROM disk='c:\Program Files\Microsoft SQL Serv...more >>

Select Distinct
Posted by Jose Valle at 2/28/2005 10:18:07 AM
Hi All, I have a small problem usint Distinct that I am sure will be easy for you guys and gals. I have a table (tblA) that has a 6 columns one of which is "SerialNumber". This table has 300000+ records. I want to be able to pull back one record for each of Distinct Serial number in the tab...more >>

how to replace iif function in mssql 2000
Posted by Vincent at 2/28/2005 10:06:02 AM
Hi, Recently, i convert the database from access 2000 to mssql 2000. After that, i find access sql function ' iif( , , ) ' can not be run on mssql 2000. So, my question is that any function can replace 'iif' in mssql 2000? Please give an example. Remark: If.. then..else can not be used in vie...more >>

sql errors
Posted by sql at 2/28/2005 9:53:34 AM
Hi all, I am getting the following errors in the event log. Table error: IAM page (1:185442) (object ID 2041058307, index ID 255) is out of the range of this database. Table error: IAM page (1:161784) (object ID 2105058535, index ID 0) is out of the range of this database. How do I ...more >>

De-dupe question
Posted by mk at 2/28/2005 9:31:14 AM
Hi, I need some help to de-duping an orders table. I have an orderitems table containing OrderID, OrderItemID, (plus a few other columns), and we need to clean the data prior to migration. We have quite a few duplicates of orders, and in moving to a template, or set based model, we want to...more >>

10039 Error
Posted by qd59 at 2/28/2005 9:31:11 AM
Hi: I got following error. Anyone can help to determine what cause this? Collation seams fine on the server. DB Error: 10039 DB Error Message: Attempt to convert data stopped by syntax error in source field. OS Error: -1 OS Error Message: (null) Severity: 7 Thanks...more >>

SQL Parameter
Posted by John . at 2/28/2005 8:36:27 AM
I have a fairly simple stored procedure that accepts two parameters: 1. CompanyID (varchar) 2. Year (int) The Year parameter is optional. If the year is not supplied, then I would like all records for the particular company returned. If a specific year is supplied, then only the record ...more >>

performance tradeoff b/w stored procedure and views
Posted by ssaud at 2/28/2005 8:22:44 AM
i have to develop a cryatal report from SQL database. I have a option to choose stored procedure OR a view i need to know which will work better on a large network in terms of speed and performance Thanx in advance -- ssaud -----------------------------------------------------------...more >>

Carry Over Hours Monthend
Posted by David C at 2/28/2005 8:15:13 AM
I was wondering if anyone knew if this was possible in T-SQL. I need to calculate the total number of hours carried over from a previous month, based on a 6 hours per day rate. Some examples, Job has 12 hours total and starts on 2/28/2005 it would carry over 6 hours into March. Job has 5 h...more >>

Stored Proc doesn't work?
Posted by roy.anderson NO[at]SPAM gmail.com at 2/28/2005 7:43:15 AM
Hey all, the malfunctioning portion of a stored proc is below. Essentially, it's the part of the proc where sorting occurs. The error is occurring because the "daystosail" and "cnt" below aren't real columns, they're created on the fly within this proc using "...AS daystosail" and "...AS cnt" ...more >>

Query Problem
Posted by Wayne Wengert at 2/28/2005 6:13:40 AM
This has to be obvious but I can't see the problem. I am executing the query: ======================================= Insert Into TempTable (email) Values (Select Distinct N1.Email From Names N1 Inner Join Bands B1 On B1.BandDirector = N1.NameID Where B1.BandClass In ( 'A', 'AAA', 'AAAAA')) ...more >>

Simple Stored Proc Question
Posted by Robert at 2/28/2005 5:21:01 AM
I am very new at stored procs and I have one that is puzzling me. I run the stored proc and it returns what it should but also runs the error handling code. I know this is very basic but I can't figure this out. Thanks and here is the code: CREATE PROCEDURE getSecurityLevel_sp (@user_i...more >>

Query runs fine on SQL 2000 but Times out on SQL 7.0
Posted by tmeister at 2/28/2005 3:57:02 AM
I have a query that I have developed on SQL Server 2000 that times out when it's moved to a system running SQL Server 7.0. I've include the steps from the execution plan within Query Analyzer below that are taking 40% and 60% of the time. Stream Aggregate/Aggregate Computing summary value...more >>

Trigger Help
Posted by Dave Hickey at 2/28/2005 3:11:01 AM
I have a basic question about Triggers. I have a table within our CRM database that has information about contacts (tblcontacts) for our client base. I have a field in this contact table that is called datemodified. I want this field to be updated everytime any part of a record is updated....more >>

Help with Outer join
Posted by cc900630 NO[at]SPAM ntu.ac.uk at 2/28/2005 2:42:44 AM
How can I join 3 tables that represent many-many realtions, in a way that returns all the values of one table and an extra column of true/false or null or some way to to show that the record exists or doesnt exist in the link table. This is so that when I pass a paramter of an author ID I can...more >>

import fils log
Posted by Hadar at 2/28/2005 2:00:23 AM
Hi, Is there a simple way to get files "date modified" into table, any xp_sp?. the only solution I found is to use parsing on "dir" command whith the cmdshell. The motivation is to check data files downlowded every day are to be changed. Thanks, Hadar ...more >>

@@identitiy always returns a value of 1 from sp
Posted by TJS at 2/28/2005 1:41:50 AM
The data is entered correctly but identity of new record is always sent back as 1 . Why is this always returning a value of 1 ? sp: Create PROCEDURE AddPlayer @SQLCMD nvarchar(1000) AS BEGIN EXECUTE sp_executesql @SQLCMD END SELECT SCOPE_IDENTITY() ...more >>

How can client applications know if a table has been changed by another user?
Posted by Wyk at 2/28/2005 1:06:43 AM
Is there a mechanism in SQL Server 2000 for notifying client apps in a multiuser setting when a change has occurred in a table (notification event). And/Or, is there a way a client application can 'ask' if a table has changed? Thanks, Wyk ...more >>


DevelopmentNow Blog