Groups | Blog | Home


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
August 2008
all groups > sql server programming > december 2003 > threads for wednesday december 3

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

Runtime error '2147217871 (80040e31)' Timeout Expired.
Posted by Vamsi at 12/3/2003 11:35:17 PM
Hai can someone suggest me what is the problem with my code? 1. Actually i keep getting the error: Runtime error '2147217871 (80040e31)' Timeout Expired. I am using "cnPubs.ConnectionTimeout = 0" this command in my code so it should not give me a timeout error.But i keep getting the...more >>


SQL Puzzle: trying to get rows in grouped query even if they have no data
Posted by James at 12/3/2003 11:24:18 PM
I'm trying to do a query which breaks out sales summed by day and also grouped by week starting date. The starting table looks like this: Initial Table ID SaleDate Amount 1 11/4/2003 100 2 11/4/2003 90 3 11/7/2003 50 4 11/8/2003 25 5 11/10/2003 60 6 1...more >>

Insert privelege
Posted by Anand at 12/3/2003 10:40:34 PM
Hello All, I am putting forward a typical situation: User A does not have Insert privilege on TableA, but he has execute privileges for all Stored Procedures. Inside the stored Procedure 'ProcA': CREATE PROCEDURE ProcA as BEGIN EXECUTE('Insert into TableA....') END When User A ...more >>

Import/Export to/from Excel File
Posted by rictonline NO[at]SPAM yahoo.com at 12/3/2003 10:18:16 PM
Hi to all Wiz out there How can I import excel file into SQL using VB6 and export back to excel. Thanks a lot for your help RicT...more >>

HELP - xpsql.cpp: Error 87 from GetProxyAccount
Posted by anonymous NO[at]SPAM discussions.microsoft.com at 12/3/2003 10:02:28 PM
Does any one know what this is about i think its something to do with running the xp_cmdshell [Microsoft][ODBC SQL Server Driver][SQL Server]xpsql.cpp: Error 87 from GetProxyAccount on line 604 thanks mic...more >>

sendmail
Posted by jjk at 12/3/2003 9:19:15 PM
From a trigger, how can I send a user an email in mssql 2000? The user's email is in a field from the record created in the trigger. thanks, raul Rego rrego@njpies.org ...more >>

Record Count for Criteria
Posted by Tim M at 12/3/2003 9:06:19 PM
Hi, I want to output a count in a SELECT query of the number of records which match the following criteria: Field_A <= Field_B AND Field_A >= Field_C I gather I can use something like: SUM(CONVERT(smallint,Field_A <= Field_B AND Field_A >= Field_C) AS MyCount Is this correct? H...more >>

Access ADP - Help
Posted by Mickey Mickey at 12/3/2003 9:02:56 PM
Hi, would anyone be kindly to help me ? Here is my scenario, hope that you don't mind seeing it. How do I be able to convert this using stored parameter as suggested or anything that might works ? Thanks. On my form: frmJobCostReport, I have a drop down selection where I select the JobNumbe...more >>



how to join two select results into a recordset at stored procedure
Posted by Mullin Yu at 12/3/2003 7:28:39 PM
I want to know how to return a recordset from a stored procedure within more than one Select statement. The following will return a recordset easily at the IF statement, but, how can do return a recordset from more than one select statement at the ELSE statement SET QUOTED_IDENTIFIER ON G...more >>

delete multiple posts using DATEDIFF()
Posted by mattias g at 12/3/2003 6:17:06 PM
Hi, I hope somebody can help me with my problem, I have a table with users, containing userID, username, loginDateTime etc... I want to create a stored procedure to delete users from the table where the datediff is more than 1 hour. I have this code: SELECT DATEDIFF(h, loginDateTi...more >>

Running a stored procedure on AS/400 from MS SQL
Posted by Todd Heiks at 12/3/2003 5:43:28 PM
I have attached an as400 from SQL2000. Can I run an update query on the attached 400? I have a stored procedure that updates and returns a recordset, can I run a stored procedure on the 400 from MS Sql? I have a stored procedure that just returns a recordset. Can I run that from MS SQL? ...more >>

Use a StoredProcedure within an INSERT string?
Posted by rooster575 at 12/3/2003 5:17:11 PM
How can I do the following?.... INSERT INTO FirstTable ( someColumn1, customUniqueIDcolumn ) SELECT someColumn1, (exec sp_mystoredprocedure) FROM OtherTable In other words, I need to copy 1 table to another, but during the copy, I want to access an SP for each and every row that I insert. ...more >>

Using Rand() in Function?
Posted by Stamey at 12/3/2003 5:00:02 PM
I am trying to create a user function that utilizes Rand to return random values. In testing it works like a champ, and you can configure parameters for it, but when I attempt to create a function with the script I get the following error, and I can't figure out what's wrong. Server: Msg 443, ...more >>

Finding out if a database is in use (2nd attempt)
Posted by (dorianwolter NO[at]SPAM hotmail.com) at 12/3/2003 4:55:10 PM
Is there a way to determine dynamically if a database is in use in a SQL Script? I would like to rename a database in a SQL script, but only if it is not in use. What I am trying to do looks somewhat like this: while DATABASE_IS_IN_USE('mydatabase') begin waitfor delay '00:01:00' end e...more >>

Finding out if a database is in use
Posted by (dorianwolter NO[at]SPAM hotmail.com) at 12/3/2003 4:53:07 PM
Is there a way to determine dynamically if a database is in use in a SQL Script? I would like to rename a database in a SQL script, but only if it is not in use. What I am trying to do looks somewhat like this: while DATABASE_IS_IN_USE('mydatabase') begin end begin exec sp_rename 'mydata...more >>

Collate woes.
Posted by Tony S at 12/3/2003 4:48:18 PM
I am attempting to join a SQL table to a pervasive one. Here are my tables. CREATE TABLE [sql] ( [EmployeeID] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL , .... ) The other table is through a odbc pervasive linked server: Other table employid varchar(15)...more >>

how to pass array parameter to stored proc
Posted by lee_j at 12/3/2003 4:42:16 PM
Hi, I want to pass array parameter to stored proc.But I can't find the array data type in Sql server 2000 online doc.Please tell me whether the data type exists.If it doesn't exist,how should I implement it. Thanks for advice Jack ...more >>

Temp tables in dynamic SQL?
Posted by Mike at 12/3/2003 4:37:24 PM
All, I am trying to consolidate several stored procs into one. Basically, they all perform the same tasks; just 4 possible values may change. I want to dynamically create query strings and then execute them. Here is an example: SET @SQLString = 'SELECT o.SurName, o.GivenName, ' + ...more >>

Dynamic naming of a table
Posted by Steve Lloyd at 12/3/2003 4:19:39 PM
Hello, I am trying to create a table for month end information that is created dynamically as part of a daily process, problem is I cannot work out how to specify a variable for the table name. I am trying: SET @TableName = 'dbo.' + CAST(Month(Getdate()) as varchar) + CAST(Year(Getdate()...more >>

Lock Spy Script
Posted by Klaus L Jensen at 12/3/2003 4:18:33 PM
Hey I would like a Script as can tell my all locks in <db>.<owner>.<table> I have made a simple script telling me all locks on a DB, can I do this on objects??? Please help me! Med venlig hilsen Klaus Ladegaard Jensen TECHOTEL ...more >>

Yukon Question
Posted by Craig at 12/3/2003 4:13:35 PM
Can a user defined function developed in T-SQL (Yukon) access (read and modify) temporary tables? If so, will this be implemented in the next BETA release? BETA 1 doesn't implement this functionality. Craig ...more >>

Problems With ANSI PADDING
Posted by Al Willis at 12/3/2003 3:45:34 PM
I'm trying to have trailing spaces removed from columns. I've done the following: ALTER DATABASE NAMEOFDB SET ANSI_PADDING OFF I verified that the setting was off using DATABASEPROPERTYEX I then created a new table. (I know that the change will only impact new columns). When I add sp...more >>

User-defined functions vs. subqueries
Posted by Arbajram at 12/3/2003 3:34:07 PM
Hi, I have one "master" table and one "child" table. Each record of the master table is connected to mutiple records of the child table by field "masterid". Question is - is the query with user-defined function faster than without it? 1. select m.*, (select count(*) from child c1 where ...more >>

Automation Error -2147023782 (0x8007045A)
Posted by John Martin at 12/3/2003 3:33:56 PM
Language: Visual Basic 6 SP5 Data Access: MDAC 2.8 OS: Windows 2000 Professional SP4 Database: SQL Server 2000 Standard Edition SP3a (which is running on the same computer as the application) The attached code runs every hour based on a timer. It runs fine for several days (around 2 weeks), ...more >>

Varchar to Float
Posted by forumjob NO[at]SPAM hotmail.com at 12/3/2003 3:33:41 PM
Hi All, does anybody know why this sql statement gives me this output - 1461.5119999999999 Select Cast('1461.512' as Float) From TableName The result I need is 1461.512 of datatype float. How do I fix it? Thanks much...more >>

can I use MS Access reports on SQL Server 2000 db?
Posted by Rogue Petunia at 12/3/2003 3:30:11 PM
Hi, I have a SQL Server 2000 db on which I would like to perform querys and have pretty reports printed. Can I use MS Access (for the pretty reports) to connect to the SQL Server 2000 db? If yes, can you please tell me how to set up the connection? Thanks, Rogue Petunia ...more >>

Ordering a resultset
Posted by Gerry Laenen at 12/3/2003 3:15:11 PM
Hi all, I developed a stored-procedure that returns a resultset of 8 columns. Is there a way to parameterize the sorting of the data? In example, when I want to sort on the 5th column, I pass 5 to this procedure and data should be sorted on the 5th column. Another solution would be nice too...more >>

View to return a computed boolean column
Posted by Rene at 12/3/2003 3:12:32 PM
Hi, from a newbie - working hard to ramp up on SQL ... I'm trying to create a query which ... looks as the value of a column and returns a boolean value based on its content. In Access SQL I have: SELECT Transaction, ([Module]=1 Or [Module]=5) AS Jump FROM tT; So the Jump column in t...more >>

import data
Posted by gcamas at 12/3/2003 2:09:54 PM
Hi, I have a table with 4 cols already have data in it. The last cols is datetime. I want to import a CSV files with 3 fields into this table but also put in the 4th field with datetime. It doesn't matter if its DTS or bulk insert or bcp. Can someone help me? Thanks ...more >>

Views vs Straight Query...
Posted by Morgan at 12/3/2003 1:49:13 PM
Given the following view definition, running=20 select * from vwLostFuelRebatesDECS where memberid =3D '05060129'=20 takes just over a minute to return the 41 rows.=20 CREATE view vwLostFuelRebatesDECS as --Used for Lotus Notes DECS select ISNULL(VG.Transactiondate, MS.Transactiondate) ...more >>

Re sequence Id numbers
Posted by Reg Besseling at 12/3/2003 1:07:52 PM
Hi all Please help with the following I have a file witl a id/sequence number i would like to resequence these numbers this is as close as i have gotten set rowcount 1 update temp_Reports set identifier_id = (select max(identifier_id)+1 from temp_Reports) where identifier_id = (sele...more >>

get default value
Posted by Chris Coho, Jr. at 12/3/2003 1:03:47 PM
Hi, i'm working on an asp project that will work similar to enterprise manager for remotely managing some aspects of a sql database. What i'm stuck on is how (in vbscript or with SQL commands) can i find out what the default value (if any) is for a given column of a given table? I know there a...more >>

getting a DTS error ...
Posted by lubiel at 12/3/2003 1:03:44 PM
Hello, Someone knows why i am getting this error when I try to apply DTS...external File from my Enterprise manager in SQL Server 7 "Failed to transfer 1 Table(s) Double Click on the error row to get a detailed description of the error:" So, did that: "Error at source for row number...more >>

Row handle referred to a deleted row or a row marked for deletion
Posted by James Brown at 12/3/2003 12:41:31 PM
Hi! I've just recently migrated a VB system from Microsoft Access to SQL Server 2000, and a few pieces of code loop through a recordset like the following example: do while not rsRecordset.eof if ...... then rsRecordset.delete else .... (add a new record, or edit ...more >>

Stored Procedure Question
Posted by Bryan Harrington at 12/3/2003 12:34:25 PM
I'll admit.. I'm a SP n00b, so be gentle. I'm using DTS to import a text file into a table on a somewhat regular schedule (hourly). After the file is imported, I need to do a couple of different things to it. The piece I'm stuck on is, how do I Loop through TableA and insert records into T...more >>

finding the max row
Posted by david branch at 12/3/2003 12:23:10 PM
Say you a table that looks like this... PK FK DTE 1 1 1/20/2003 2 2 1/20/2001 3 1 1/21/2003 4 2 1/20/2003* 5 1 1/20/2003 6 3 1/20/2003 The Goal is to get the row with max or last date based on the fk Select * from testTable as t1 where t1.fk=2 and pk = (select PK from test...more >>

How to get AD groups using T-SQL
Posted by Paul at 12/3/2003 12:21:18 PM
Hi all I want to get a list of current Active Directory groups in a particular OU in a particular domain ("ou=testing groups paul,ou=47 Clarence", "dc=cips,dc=gc,dc=ca"). More to the point, I want to ensure that the one I'm trying to grant a login to has been replicated when I do the sp_grantlogin...more >>

Query Not Returning Values and process is waiting on CXPACKET
Posted by sfibich at 12/3/2003 11:45:00 AM
Good Morning All, I have a query from a user that I have been asked to take a look at. I have narrowed down the issue to one of the parameters in the query. When the query covers 2002 thru 2003 one execution plan is issued when the query covers only a portion of 2003 a second execution plan...more >>

Clustered Index Scan vs. Table Scan
Posted by BenignVanilla at 12/3/2003 11:33:11 AM
This is a follow up post to the "Are Table Scans Always Bad?" post I posted last week. I am in the process of re-indexing some tables, and I have been cleaning things up so execution plans show no table scans. Performance seems to be helped not hurt, so I was just curious, is it safe to say: A...more >>

Problem with FETCH LAST
Posted by williaj NO[at]SPAM rrb.gov at 12/3/2003 10:38:26 AM
Hello everyone, hope someone can help me with this. I have a SQL stored procedure that inserts a record into a table, creates a cursor to fetch the last record that was added to get the unique key that was created and then writes that and other info to a separate table. This procedure was w...more >>

Need Help Padding a String w/ 0's
Posted by Lynn Pennington at 12/3/2003 10:34:33 AM
Have a field that I need to Pad the Left with 0's. 1234 -> 0001234 123456 -> 0123456 Please help. Lynn....more >>

IsNumeric
Posted by JakeC at 12/3/2003 10:31:39 AM
I have a varchar column. How can i validate the values in it are of smallint without causing arithmetic overflow error. thanks...more >>

SQL Query Help
Posted by dave at 12/3/2003 10:25:04 AM
I have two tables: Company & Users_Allowed, which holds user ID's and a company ID to determine if that particular user can administer that particular company. What i need is a record set that alway returns the entire list of companies from the company table, but have an additional column in i...more >>

Help with a stored procedure!
Posted by Damon at 12/3/2003 10:12:43 AM
Hi, I have a stored procedure which works perfectly when in the WHERE statement I reference 'UPRN' or 'POSTCODE' but when I try and reference 'ADD1' it tells me that it is an invalid column name. Any ideas on whi this is happening?! Wuld appreciate the help guys & gals! Here is my code: ...more >>

SP Debugging without .NET
Posted by Gerard at 12/3/2003 10:06:53 AM
Is there any tool that comes with SQL Server that you can Debug (step through) a SP. I know it is different from typical code in the way the execution path is set up , but there must be a way. I know you can do it with .NET but we use VB 6 here at the office, and our MIS director resists...more >>

Data Type
Posted by Yaheya Quazi at 12/3/2003 10:03:04 AM
Hi I have found this in a datadictionary. Does anyone know what it means? DataType: decimal(15,4) I have tried to give my field the "Decimal" but it does not let me type 15. Please help. ...more >>

Top 1
Posted by Craig at 12/3/2003 10:00:09 AM
I have a parent and a Child table. I want to select the first child record for each Parent record How do I do this? TIA Craig ...more >>

List of roles a user belongs to
Posted by Bill Hunt at 12/3/2003 9:56:34 AM
Hello, I need to get a list of roles the current user(windows authentication) belongs to in a stored procedure. I can get close using a combination of sp_helpuser and suser_sname...somtheing like this: CREATE PROCEDURE GetRolesForUser AS DECLARE @UserName varchar(50) SET @...more >>

Using a stored procedure in a select statment
Posted by karen at 12/3/2003 9:13:58 AM
I need to used a stored procedure in a select statement. Ie. using the results of the stored procedure like a table. I would also like to create a view based on the results of a stored procedure....more >>

multifactor regression analysis in SQL?
Posted by tc64 at 12/3/2003 9:02:22 AM
I want to perform multifactor regression analysis on data contained in SQL. I then want to store the results of the regressions (e.g. the coefficients and t-stats) in a SQL table. Any tips on how to approach this and/or leads on 3rd party products are appreciated. Thanks....more >>

SP Escape Character???
Posted by Gerard at 12/3/2003 8:28:26 AM
I am migrating SQL from VB to T-SQL in a SP for SQL Server. Everything is fine, but I can't make, or use an Escape Character ('\', '%' for example.) I am building strings in the SP and NEED a Escape. I follow the documentation and it does not work. Any Thoughts?? P.S. Thank you Linda...more >>

Connecting to SQL Server DB
Posted by John Spiegel at 12/3/2003 8:17:07 AM
Hi all, I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server and suspect that it's a problem on that side. I've installed the SQL Server developer edition locally and do have a pubs database. The connec...more >>

Cursor output to table
Posted by Dean at 12/3/2003 8:05:01 AM
I would like to output the results from the statement EXEC ("sp_depends " + @TABLE_NAME) to a table for future analysis. The cursor is listed below. Please help me with this problem. Thank You, Dean DECLARE @TABLE_NAME sysname DECLARE @SAVE_STRING_TABLE VARCHAR(255) DECLARE ...more >>

parsing a set of answer
Posted by KIm at 12/3/2003 7:56:10 AM
I have a set of answer in a table from a survey that I want to parse out. Below is an example of some of the questions in a survey. In comparison to other analysis tools, please rate our tools on the following? The Best Better Than Most Average Need Improvements ...more >>

In SQL2K What is the start of a New Day in Date Time format?
Posted by AJACode at 12/3/2003 7:52:07 AM
IS the beginning of a new day in Date Time format in SQL server 2000: A) 12:00:00 AM OR B) 00:00:00 AM ? C) Makes no Difference I have heard that A is actually 12 Noon a nanosecond before the PM cycle since PM is actually 12:00:01 Thanks for the Reply...more >>

Please help with dynamic sql query
Posted by ajayz90 NO[at]SPAM hotmail.com at 12/3/2003 7:16:25 AM
I am trying to execute a dynamic sql query and get the following problems: when i run the code as a sp on another server it works ok.However when running it on the query analyser i get the following error message Server: Msg 207, Level 16, State 3, Line 6 Invalid column name 'exec master..xp_...more >>

parsing a set of answer
Posted by Kim at 12/3/2003 7:06:05 AM
I have a set of answer from survey which I need to have it parse out. It is currently in a table like this: TheBestBetterThanMostAverageNeedsImprovementUnsatisfied How do I get the answer to be like this? The Best Better Than Most Average Needs Improvement Unsatisfied Below is the ...more >>

Help ! With dynamic SQL
Posted by ajayz90 NO[at]SPAM hotmail.com at 12/3/2003 7:00:13 AM
I am trying to run this code on the query analyser and i get the error Server: Msg 207, Level 16, State 3, Line 8 Invalid column name 'exec master..xp_cmdshell 'copy '. Server: Msg 207, Level 16, State 1, Line 17 Invalid column name ''' However the same runs fine on another server.... Any ...more >>

Blocks on sp_getkey Stored Procedure
Posted by Carl at 12/3/2003 6:12:02 AM
We created the sp_getkey store procedure that outputs maximum value to the next record. We have blocking problems with this procedure listed below. Please help me resolve this issue. Thank You, Carl Create Procedure sp_getkey @vc_TbleNme varchar(128), @i_Ky int Output, @i...more >>

Row ID problem
Posted by elvira at 12/3/2003 5:18:30 AM
I have changed database from Sybase to Microsoft SQL. And now I got a problem: when Dataset is set to the GridControl and I am trying to update datas - the message is coming: DataSet has no unique row identifiers... Shall I set for every primary key also rowID? Any idea?...more >>

Explanation of a Select result set
Posted by pl NO[at]SPAM unitasoft.com at 12/3/2003 4:29:44 AM
How's about ye, I am interested in getting an explanation for the following (simple) sql query: select * from ey_ftrn where ftrn_prtd <> 'T' The field ftrn_prtd is a normal varchar field. In our application, the value is only ever set to T, so the only values that are in the database for...more >>

Changing one data field in an INSTEAD OF INSERT trigger
Posted by Ervin Nagy at 12/3/2003 3:36:05 AM
How could I change only one data field in an INSTEAD OF INSERT trigger? In my application the table structure can be modified dinamically (adding/modifying/deleting fields). Therefore, I can not hardcode all the fields in my INSTEAD OF INSERT trigger. At the same time, I have to change one datafi...more >>

Extended stored procedures
Posted by Aquino at 12/3/2003 2:51:10 AM
Hi, does someone know how to get the user's private data from the structure SRV_PROC passed to a extended stored procedure in a DLL? there is a definition on the SRV_PROC structure in the (srvstruc.h) but no documentation on how to use it: void * userdata; // pointer to user's p...more >>

Novice needs Logic
Posted by Traci at 12/3/2003 2:46:04 AM
I am writing a set of reports on a Workflow system. I have a main table which is basically an Audit Trail of every move an entity makes. What I need to do, is for every record that is generated, I want to join it to the previous for that entity in order to obtain certain fields which have a differen...more >>

Can I use a 'Conditional CHECK' constraint ?
Posted by Krist Lioe at 12/3/2003 2:40:54 AM
Hi SQL Gurus, Using Sql2000, I have a table to maintain stock availibility, the requirement is qty_in_orders must be <= qty_on_hand, so I use CHECK constraint like below : CREATE TABLE StockAvailibility (prod_code CHAR(5) NOT NULL PRIMARY KEY, qty_on_hand INTEGER NOT NULL, qty_in_orders I...more >>

return nvarchar(4000)
Posted by Daniel Rakojevic at 12/3/2003 1:49:01 AM
Hi! I want to return a generated text with a function, but with nvarchar it is only possible to a size of 4000 ! I cant use text or ntext in a function. How to return a text greater than 4000 characters ? Thanks, Daniel Rakojevic ...more >>

Newbie SQL Stored Procedure
Posted by Tim M at 12/3/2003 1:48:04 AM
Hi, I have created the following function in MS-Access as follows. Can anyone tell mwe how this could be translated into an SQL stored procedure. ********************************************************** Function setKPIPassCriteria(strRefNo As String) As Boolean Dim rsDefn, rsMths ...more >>

Trigger Not Executing
Posted by Peter Newman at 12/3/2003 1:32:32 AM
i have created a trigger as follows CREATE TRIGGER TRIG_CLEARRECORDS ON Table1 FOR DELETE AS DELETE Table2 WHERE LedgerKey in (SELECT LedgerKey FROM Table1 WHERE RecievedDate = '02/12/2003') Print ' Triggered ' If i then do a Delete from Table1 where R...more >>

CursorLocation: Client Side Cursor (How does it work?)
Posted by gonzal at 12/3/2003 12:01:02 AM
Hi I have few questions about the Client Side Cursor: What I know so far about Client Side Cursor is that the table content (recordset) is created on the client’s computer and not on the server. Because of that, the network traffic is increased... but it puts less pressure on the server. Quest...more >>


DevelopmentNow Blog