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 thursday september 2

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

Linked server to Paradox database
Posted by mchenna2000 NO[at]SPAM yahoo.com at 9/2/2004 9:30:23 PM
I am using SQL Server 2000 and trying to add linked server to a paradox server. First I have created DSN and used this dsn name in the linked server connection. It failed. Then I tried creating the linked server using the server name instead of dsn. It failed. I used OpenRowSet and SQLOLEDB prov...more >>

Alter table constraint with variable?
Posted by Earl at 9/2/2004 9:27:47 PM
I need to give my users the ability to change default values. I can obviously use a hard-coded value here, but I cannot use a variable to re-add the constraint. Any ideas? ALTER TABLE Sales ADD CONSTRAINT DF_Sales_EstSubManDays DEFAULT @EstSubManDays FOR EstSubManDays ...more >>

.Net DateTime type and SQL DateTime type
Posted by Matthias S. at 9/2/2004 7:31:16 PM
Hi there, I'm writing a C# application and using a C#Express Beta2 and SQLExpress Beta2: I've created an object (say 'Human') which I persist to a SQL DB table. Human has a DateOfBirth property of the (.Net) type DateTime. The apropriate field in the table is of SQL type DateTime. Now I ...more >>

Error : 7105 Page (1:110801), slot 3 for text, ntext, or image node does not ex
Posted by drone at 9/2/2004 6:46:44 PM
Hi there.. Sometimes, when reviewing SQL ErrorLog file, I found many 7105 Error like this, Page (1:110801), slot 3 for text, ntext, or image node does not exist.. there is no enough explanation about this error in the BOL. so, How come this type of error occurs? and How can I fix th...more >>

Bcp to Filed terminator help
Posted by Vanuser at 9/2/2004 5:25:01 PM
I need export data with filed terminator | (Pipe Delimitated) bup ........... ' /c /t, /r /SLoad2' +' /U sa' + ' /P sa' i know If use /t, I am able get below data. Unknown,360,7563944,Chirs,Test,200 fair road,test,canada,54110,CA,100 If I want below data format what needs to chage. I ...more >>

error(urgent) - Maximum number of databases used for each query has been exceeded
Posted by Nikhil Patel at 9/2/2004 5:18:35 PM
Hi all, I have written a update trigger on contact1 table of db1 database to update contact1 table of db2 database. Both tables need to have same values in some of the fields. I have also written a similar trigger on contact1 table of db2 to update contact1 table of db1. I get the following e...more >>

creating visual field
Posted by Savas Ates at 9/2/2004 5:11:13 PM
i have some fields.. name ,surname,studentno select name ,surname,studentno order by name i want to create a visual field to keep my resultset's order number like this after query visual column name 1 ali 2 ibo 3 saban 4...more >>

Triggers
Posted by Prabhat at 9/2/2004 5:10:31 PM
Hi All, I am New to SQL Server Triggers. In Oracle there are Before | After Triggers. BUT In SQL Server All Triggers are By default AFTER. And Again a Instead Of Trigger Will Override the Triggering Statement. Then How Do I write a Before Trigger? Suppose I want to Store the Employee Rec...more >>



sum of another sum
Posted by ChrisR at 9/2/2004 5:03:31 PM
sql2k sp3 Probably not the best title, but couldnt think of a better one. create table #tmp (CustomerKey int,CallDate datetime) insert into #tmp values(1,'01/01/04') insert into #tmp values(1,'01/02/04') insert into #tmp values(1,'01/03/04') insert into #tmp values(2,'01/01/04') ins...more >>

mod 10 in SQL
Posted by JT at 9/2/2004 4:41:33 PM
does anyone have a stored procedure they would like to share with me that does a mod 10 check to validate credit card numbers and 9 digit bank routing numbers?? im feeling lazzzzy. ...more >>

Cleaning the Extended Stored Procedure params buffer..... help me
Posted by AA at 9/2/2004 4:40:31 PM
Hello, I have a big problem (for me). I have one extended SP, very simple this xp has two input param and 1 output param The param1 is for the Subscriber Id, and param2 is for the Subscriber password. Param3 is the output where I put the result of the transaction. ("Ok" or "Er") I have also ...more >>

programming help
Posted by Hassan at 9/2/2004 4:39:25 PM
This query helps me get all the identity values in all tables in a database.. SELECT db_name() DBNAME,TABLE_NAME, COLUMN_NAME, DATA_TYPE, IDENT_CURRENT(TABLE_NAME) CURR_IDENT_VALUE, FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND COLUMNPROPERTY(OBJECT_ID(TABLE_NAME...more >>

Remove Identity attribute
Posted by Imtiaz at 9/2/2004 4:29:05 PM
Hi I have a table with its PK as an identity column. I want to alter the table to remove the identity attribute from the PK column. Can I do this using T-SQL ? Thanks & Regards Imtiaz...more >>

Why this cause an wait lock ?
Posted by Craig Kenisston at 9/2/2004 3:55:54 PM
Hi, Using SQL Analyzer run this : SET TRANSACTION ISOLATION LEVEL READ COMMITTED Go if Object_ID('Table1') Is Not Null Drop Table Table1 Go Create Table Table1 (Col1 Int Identity(1,1), Col2 Int) Go Alter Table Table1 Add Constraint PK_TABLE1 PRIMARY KEY (Col1) Go Insert ...more >>

DBCC CHECKDB Results
Posted by Jeff at 9/2/2004 3:08:05 PM
Hi - I have a VB.NET Windows app that uses an MSDE database. One of the functions that users can execute is a database repair. To implement this, I am using the DBCC CHECKDB statement: strSQL = "DBCC CHECKDB ('DBName', REPAIR_REBUILD)" SQLcmd = New SqlCommand(strSQL, frmMain.c...more >>

Help combining data from two rows in one row in resultset
Posted by PEJO at 9/2/2004 2:47:55 PM
As the subject line says. FOR Example the table I start with would look like this: USER_ID TEST_ID SCORE User_1 TEST1 89 User_1 TEST2 69 User_2 TEST1 54 User_2 TEST2 64 User_3 TEST1 73 User_3 TEST2 83 and I would like my results set to look like this. <USERID <TES...more >>

Counting Occurences
Posted by Cam Bevis at 9/2/2004 2:42:09 PM
I'm having trouble getting my head around this, and no one in the groups has posted exactly the problem. The table below tracks site traffic across a network. There is 1 row per pageview and UUID is that user's unique cookie. CREATE TABLE [dbo].[Stats_Working] ( [inac_stats_id] [int] NOT ...more >>

How to connect to a specific instance of an SQL Server
Posted by Matthias S. at 9/2/2004 2:35:36 PM
Hi, I've got SQLExpress Beta 2 on my maschine installed and I'm trying to connect to it. The Service is name 'SQL Server (MSSQLSERVER)' and I was trying to connect to it using 'MyComputerName\MSSQLSERVER' but I always get an error telling me that the Server does not exist or access is den...more >>

SQL-DMO problems
Posted by Sonya at 9/2/2004 2:33:06 PM
Hello, I am working on an application that would enable user to copy certain database objects from one db to another via SQL-DMO. I am working on Windows XP, project is in C#, SQL Server 2000, all with latest service packs. Problem #1: I have problems copying objects that have quoted ide...more >>

SELECT convention
Posted by Alan at 9/2/2004 2:32:38 PM
What is the convention of quoting the fields including space ? eg. SELECT OrderID as [Order ID] FROM Orders SELECT OrderID as 'Order ID' FROM Orders SELECT OrderID as "Order ID" FROM Orders Which one is the norm ? ...more >>

Restore transaction log
Posted by Kurt Callebaut at 9/2/2004 2:28:29 PM
Hi, We are having a problem with restoring the trasnaction log on a SQL 2000 server. We have 2 backup files. A backup containing the database and a backup of the trasnaction log file. Restoring the backup is no problem but when we want to restore the transaction log we get several error...more >>

Need Simple Help!
Posted by Vai2000 at 9/2/2004 2:27:11 PM
Hi guys! Can you please point me out the steps required for tuning a Db? SELECT is taking a really long time , though don't have that much of data. I have close to million rows... Also have indexes on the table with no PK. Please advice. TIA ...more >>

Renaming Stored Prcedures via EM
Posted by Guadala Harry at 9/2/2004 1:49:32 PM
I just renamed a stored procedure via Enterprise Manager by right-clicking on the sp name and then selecting Rename from the pop up menu. The new name shows up in the EM tree view - leading me to think that the sp was in fact renamed, but the sp still retains the original name (when scripted o...more >>

Anyone up for a religious war? (low priority)
Posted by Richard G at 9/2/2004 1:47:34 PM
I'll pose the question this way... :-) Which is better to use, spaces or tabs in code (SQL, c++, ...)? The applications developers here are split between the two. The SQL developers here have a consensus on spaces (4 spaces per tab key). And there are lots of pros and cons to boths sides ...more >>

subquery question
Posted by erin at 9/2/2004 1:44:29 PM
using this ddl CREATE TABLE tbl1 (job int,sname varchar (10),type char (1) ) GO Insert Into tbl1 values(3000, 'chris', 'a') Insert Into tbl1 values(3001, 'doug', 'b') Insert Into tbl1 values(3002, 'esteban', 'c') Insert Into tbl1 values(3003, 'frank', 'a') Insert Into tbl1 values(30...more >>

Row set (Cursor don't go) as Input to a stored Procedure
Posted by Markus at 9/2/2004 1:26:47 PM
I have a store procedur witch puts many data into a table Table defenition is: create table Customer ( Name char (30), First Name char(30), Street char (30), and so one. Store Procedure definition is: Store Procedure Put_Cust @Name, @First Name, @Street, .... AS Insert Into ....more >>

Accessing Sql Database/Table/Role/etc. definitions
Posted by Matthias S. at 9/2/2004 1:25:08 PM
Hi, when using SQL Server 2000 one has the option of creating scriptfiles for all database objects, such as tables, sp's, views, users, roles, etc. I need to write a tool which can perform the same thing (analyze a database and spit out a couple of properly formatted script files) and I ...more >>

Loop through a text string
Posted by Mark Frank at 9/2/2004 12:55:18 PM
Hi all, Does anyone have a SQL or Stored Proc example of how to loop through text looking for a specific character. I.e. In the example below I'm trying to extract the unique Id's: 2336 and 133 respectively. We have a weird database system which concatenated the ids to the text in diff...more >>

Getting trigger error
Posted by Oded Kovach at 9/2/2004 12:33:24 PM
Hello there I have some store procedure that run update on table As a result of that a triggrer run On that trigger an error occured Is there a way on the store procedure to know which error occure? ...more >>

Is this SQL statement bad practice?
Posted by Steven Scaife at 9/2/2004 12:18:17 PM
This SQL statements works how i expect but i dont have any joins or anything specified and I am wondering if it is bad practice to do it like this, the result set is returned instantly so that isn't a problem, the only thing i can see that the tables have in common is the FK_ApplicationID SELE...more >>

local variable in stored procedure
Posted by Alan at 9/2/2004 12:05:31 PM
I tried the following statement in Query Analyzer DECLARE @catname nvarchar(15) UPDATE Categories SET @catname = CategoryName = 'BeveragesNEW' WHERE CategoryName = 'Beverages' SELECT @catname The result printed out the new value but not the old value of the CategoryName. BUT according to...more >>

check which field is updated
Posted by Nikhil Patel at 9/2/2004 11:50:08 AM
Hi all, I am creating a FOR UPDATE trigger on a table with several text columns. I need to check which fields have been updated in this trigger. I can do this using COLUMNS_UPDATED(). But would this work for the text fields as well? Thanks... -Nikhil ...more >>

Normalization question
Posted by Diego F. at 9/2/2004 11:44:12 AM
Hi. I'm quite newbie with that. I have 3 tables in my database and I think they are normalized, but I did nothing to ensure that. Do you think they are normalized? Tables are: dish (dish_id, name, kind, dish_price): dish_id is the pk. order (order_id, table, price, date): order_id is the pk...more >>

query
Posted by Savas Ates at 9/2/2004 11:29:05 AM
i have some fields.. name ,surname,studentno select name ,surname,studentno order by name i want to create a visual field to keep my resultset's order number like this after query visual column name 1 ali 2 ibo 3 saban 4...more >>

Desgin Assistance with Managing Identity Values
Posted by Rigs at 9/2/2004 11:28:28 AM
Hi, I would appreciate some opinions on how to best go about working with Identity data. (I have a strong Oracle background, however I am now working with SQL Server 2000 and have not been able to determine a best approach for this.) I have 2 tables, tbl_orders and tbl_order_details. When...more >>

Declareation error in Stored Procedure
Posted by bwillyerd NO[at]SPAM dshs.wa.gov at 9/2/2004 11:19:19 AM
Here is my Proc: ALTER PROCEDURE dbo.FetchFederalComment @IVDNO Int, @EmpNo Char(4), @FromDate SmallDateTime , @ToDate SmallDateTime , @CommentType Int = NULL -- @IVDNO,@EmpNo Required -- @FromDate Required in SmallDate Format MDY (ie.. 02/01/1982) -- @ToDate Required in SmallDate Format M...more >>

Newbie question. String manipulation in stored procedure
Posted by Gav at 9/2/2004 11:17:07 AM
I am fairly new to this so this might seem a silly question. What I have is a varchar with the format CCCCCC.NN.NN.CC.C.NNN where N is a number and C is a character. What I am wanting to do is change the first set of characters up to the first '.' (the amount of characters varies). I have looked ...more >>

String conversion - simple question
Posted by jhoge123 NO[at]SPAM yahoo.com at 9/2/2004 11:11:00 AM
I need to convert a varchar to an int, but sometimes the varchar is not completely numeric. I need to convert it to an int by ignoring the non-numeric characters. In other words, "9V" becomes 9 Both CAST and CONVERT will produce an error in this case. Thanks, John...more >>

query to retrieve 2nd of TOP 2
Posted by DC Gringo at 9/2/2004 10:48:04 AM
I have a query where I want to retrieve the second of the top 2 records: SELECT TOP 2 col1, col2 FROM table1 ORDER BY col1 DESC This will give me two records, but I only want to get the 2nd of the two...how can I do that? -- _____ DC G ...more >>

Stupid question about relations
Posted by Nikolay Petrov at 9/2/2004 10:39:14 AM
Example: Two tables - Customers and orders A customer may have many orders - If I make relationship between these tables to find all order for customer. This is One-to-many relationship, right? Example 2: Two tables - Customers and Companies A customer may be from only one company, but he c...more >>

Computed Columns problem
Posted by Harag at 9/2/2004 10:32:17 AM
Hi all SQL 2k I have a stored proc that gets a list of forums from the table In the select statement I have the following: SELECT .... f.ForumType, CASE WHEN f.ForumType = 1 THEN 'News' WHEN f.ForumType = 2 THEN 'General Chat' WHEN f.ForumType = 3 THEN 'Support' END As For...more >>

primary key question
Posted by Mark at 9/2/2004 10:08:48 AM
when a create a table in sql 7.x or 2000, sql server automatically creates a clustered index on primary key. is there any way I can remove this index and have clustered index on another column? Also, is it possible to change sql behavior to not create clustered index on primary key? t...more >>

Query
Posted by olivier at 9/2/2004 9:57:23 AM
Hi, I make these queries : select LD_String_Translation_Id from LD_String_Translation where LD_String_Translation_Id = 0x800000000000124D And : select LD_String_Translation_Id from LD_String_Translation where LD_String_Translation_Id in( select cast(...more >>

Padding the data?
Posted by ricard at 9/2/2004 9:54:05 AM
Currently I'm working on large historical data. Some of the data on some date is missing (<null>) and I want to fill it with the value from closest previous day. As an illustration: mytable TradeDate | Indicator 3/5/2004 | 200 4/5/2004 | <null> 5/5/2004 | 150 6/5/2004 | <null> 7/5/20...more >>

use a stored procedure in a subquery
Posted by Susan at 9/2/2004 9:49:40 AM
Hi there, I would like to recreate a stored procedure which uses the result set returned from a stored procedure in a subquery, something like the following: Create procedure GetLockInfo (@DoorID int) SELECT OperatorName, WorkstationName, RowID FROM ComponentLocks where RowID in ( exec s...more >>

Select from a selected set?
Posted by google-usenet NO[at]SPAM jstrummer.e4ward.com at 9/2/2004 9:42:11 AM
I have two separate queries that I'd like to consolidate. The first gets a count of how many times a URL shows up in the SourceURL field: SELECT SourceURL AS "Referring URL", COUNT (*) as "Count" FROM TBLCOMMENTS GROUP BY SourceURL ORDER BY COUNT(*) DESC Many of the URLs are similar;...more >>

Getting values of an Inserted record in a sproc?
Posted by A Traveler at 9/2/2004 8:53:18 AM
I have a table which has an id field. I was told NOT to use identity options for any fields in my database (i know). So i have instead a UDF which does a (SELECT MAX(ID)+1) from the table, and i have that in as the default value for the field. If i insert a record in a sproc, doing an INSE...more >>

simple math question
Posted by ChrisR at 9/2/2004 8:06:21 AM
sql2k sp3 select (1 / 3) gives me the result of 0. I dont need precise results, but would at least like to see .33. How can this be accomplished? TIA, ChrisR...more >>

dbcc output to a file?
Posted by rob at 9/2/2004 8:01:55 AM
Hi, I was wondering if it's possible to pipe the output of a DBCC command to a file. For instance, I'd like to have the following DBCC command... dbcc checkdb(Pubs, noindex) ....output its result to a file on my D: drive. Something like: dbcc checkdb(Pubs, noindex) > d:\dbcc.out...more >>

Create a table from the results of stored procedure
Posted by Andy Gray at 9/2/2004 6:24:40 AM
I have several stored procedures that take some time to run so I'd like to automatically run them as a scheduled job over night and store the results in a table. The following code works: CREATE TABLE tblham_Alert_Memory ([Computer Name] varchar (50), [New Memory] varchar(50), [Old Memory...more >>

Question regarding ISQL utility and DOS
Posted by Richard J at 9/2/2004 5:43:02 AM
Hi group, Got a question that has been bugging me for way too long ... We apply database changes by creating batch files that execute the ISQL utility with an input query file, much like: isql /Umyname /Pmypassword /Smyserver /dmydatabase /i%1 where the %1 is the name of an input .Q...more >>

need help with a Time query
Posted by Gary Spence at 9/2/2004 3:03:03 AM
hello I want extract all the records that were entered into my table since 19:00 the previous night, my sql is : DECLARE @datevar datetime SET @datevar = CONVERT(SMALLDATETIME,GETDATE() -1) print @datevar SELECT [DailyProdTotals].[PartNo], [Description], SUM([DailyProdTotals].[Qty]) AS To...more >>

Enforce uniqueness of a key referenced in multiple tables
Posted by lieven.keersmaekers NO[at]SPAM belgoprocess.be at 9/2/2004 1:48:11 AM
I have a table PBS_InspectieVat wich is referenced by two other tables PBS_Verwerking and PBS_Afvoer. How can I enforce that the key 'InspectieVatID' is only used once accross the two referencing tables? I know I could create triggers on the two tables to do the check but it seems to me there...more >>

SELECT @@IDENTITY doesn't give the right value because of a trigger. Any work around?
Posted by Willianto at 9/2/2004 1:47:13 AM
Hi all, I insert a record to the parent_table, and then insert some records to the child_table. To get the parent_table pk, I used SELECT @@IDENTITY right after I insert the record to the parent_table. Problem was the SELECT @@IDENTITY statement doesn't return the correct value. After banging...more >>

rebuilding indexes - causes recompilation?
Posted by JB at 9/2/2004 1:24:41 AM
Can anyone tell me if rebuilding an index causes recompilation of a stored procedure the next time it is run, or do I need to amnually run sp_recompile? Also, how about adding a column to a table - does that cause recompilation? TIA, JB...more >>


DevelopmentNow Blog