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 > may 2005 > threads for thursday may 5

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

How can I change PRIMARY KEY using code?
Posted by §Chrissi§ at 5/5/2005 9:51:12 PM
Hi, Assume I have a PRIMARY KEY on one column. =20 How can I change PRIMARY KEY onto a new column using code? Do I have to recreate the table? Thanks....more >>


Avoiding truncate error
Posted by Romano Benedetto at 5/5/2005 6:53:40 PM
There is some option in Sql Server 2000 to set of avoid errors when a text larger than destination field is stored in it ? For example i must do an INSERT INTO NAMES and NAMES have a field of size 10 if i store a field of size 20 in it the server give me an error can i avoid this error...more >>

Create table with PK on two columns
Posted by §Chrissi§ at 5/5/2005 6:44:24 PM
Hi, Could you tell me the syntax to set primary key on two columns when I create a table? I can't find it in the books. The syntax I found is CREATE TABLE MyTable (c1 INT PRIMARY KEY,c2 INT) How can put c2 as part of PRIMARY KEY? I don't know how to use CONSTRAINT. So if CONSTRAINT ...more >>

Unable to connect (ODBC DSN) after changing user's pw
Posted by Mark Findlay at 5/5/2005 5:54:52 PM
I am maintaining a website that connects to a SQL Server database via a system ODBC DSN. The connection had worked fine until the password changed for the userid used in the connection string. Here is the VBScript snippet that used to work fine. DSN_Name = "DSN=mydsn;uid=dsnuser;pwd=xyz12...more >>

differnt result from QueryAnalyzer and myDTS package when calling a sp
Posted by Ray5531 at 5/5/2005 5:38:49 PM
Hi This select in my sp when I call it from Query Analyzer works and when I call it from my DTS package it dosen't work.it returns NULL into @C4ENROLLMENT_ID SELECT @C4ENROLLMENT_ID=CAST(ENROLLMENT_ID AS NUMERIC(9)) FROM dbo.IF_C4TRANSFORM WHERE FILEID=@INTERNAL_FILEID AND LINE_NUMB...more >>

Error in SP using Dreamweaver
Posted by Aleks at 5/5/2005 5:31:03 PM
Hi, I am calling a stored procedure from DreamWeaver, but I am getting an error, perhaps someone can help (It has to do with the last field (text), if I use nvarchar instead works fine. SP: CREATE procedure Addtemplatestocase @FirmId int ,@CaseId int , @SecLtr nvarchar(50), @LtrName nv...more >>

Aggregating string values
Posted by news.microsoft.com at 5/5/2005 5:13:52 PM
Hello All, I have table with two fields, Field ID1 can repeat but not ID2. ID2 is unique primary key Both have string data type Table T1 ---------- ID1 ID2 x x1 x x2 x x3 y y1 y y2 Now I...more >>

UPDATE query questions
Posted by Pascal Duchemin at 5/5/2005 4:36:10 PM
Hello, What would be the easiest way using a SQL query to do this : I have a table with columns: ID(int), data1(int), data2(int) I want to copy for each ID data1 to data2 so : ID - data1 - data2 1 - 90 - 0 2 - 239 - 0 3 - 213 - 0 Will become : ID - data1 - data2 1 ...more >>



Linked Server Table Question!
Posted by Mark S. at 5/5/2005 4:16:01 PM
Hello, Is there a way, through t-sql, to query a linked server and display its list of tables? I know you can see the list through Enterprise Manager but am wondering if there is a way view the list with a query. Any help would be greatly appreciated! Thanks in advance. ...more >>

SQL Server statistics
Posted by Igor Marchenko at 5/5/2005 4:06:26 PM
Hello! I am really puzzled by the was SQL Server is using statistics. I was looking at DBCC SHOW_STATISTICS output for one of the indexes. I noticed EQ_ROWS value and executed query WHERE <indeed column>=<value>. Query plan showed number of rows I expected. When I executed similar query...more >>

ALTER table in a SP
Posted by Rob T at 5/5/2005 3:59:24 PM
Hi. I have a stored procedure where I'm creating a Temporary table, inserting data into it from another stored procedure, than altering it by adding another column, then doing more stuff within the temp table. My problem is after my Alter statment, I need to use a GO statement to the table...more >>

COUNT(*) INTO a variable in SP
Posted by Ray5531 at 5/5/2005 3:37:30 PM
I need to get acount(*) of a table and use it later in my sp,How can I do that? Thanks ...more >>

TSQL optimal recordset solution is sought. Please help.
Posted by Farmer at 5/5/2005 2:33:51 PM
/* Please help. Thank you for your time and ideas. Given this data setup how do I answer efficiently this question? The result set can be very large of sales. For a given sale, are there any other sales of the same maker, that have been sold in the same configuration? In this data, sales...more >>

View Text DataType Data in Query Analyser
Posted by Rajesh at 5/5/2005 1:30:26 PM
I got a Table which has Text Data Type ... I inserted around 15 to 20 pages document into Text Data type Column. But when Reterive the table using select query I can only view 8 kb of data. I cannot view the complete 15 or 20 pages which I inserted. Is there any way to view the Data. Th...more >>

Mass @@IDENTITY, sort of
Posted by John Spiegel at 5/5/2005 1:05:12 PM
Hi all, I'm preparing to pull data into a new DB from an existing system. The first piece of this is to copy from one flat file (Customer) into two files (Entity and Role) into the new DB. The problem I've got is that I need to create the key in Entity and then use that key to insert the ...more >>

FOR UPDATE clause in cursor
Posted by Mark at 5/5/2005 12:05:42 PM
I'm refactoring a cursor written by another employee. It includes a cursor that uses the FOR UPDATE clause to update records as the cursor iterates through the records. Please assume that the cursor cannot/should not be replaced. When executing the snippet of code below, I get the SQL Ser...more >>

how to compare with T-SQL
Posted by SQL Apprentice at 5/5/2005 11:12:20 AM
Hello, I have a list of employees (+5000) that I use to compare with a database. I can find the employees that match the list. How can I find the ones that are not in the database from this employee list? For example, This is the Employee List (text file) EmployeeID LastName Fir...more >>

Query help
Posted by Jack at 5/5/2005 11:04:58 AM
This group is always awesome. Thanks in advance for your help. I need to put together some recordsets for a charting application. I think this is everything (ddl, data, expected result set.) Thanks again. CREATE TABLE [dbo].[Tracking] ( [key_] [varchar] (10) COLLATE SQL_Latin1_General_...more >>

delete duplicate record problem
Posted by Rich at 5/5/2005 10:42:04 AM
create table tbl1( fld1 varchar(10), fld2 varchar(10)) insert into tbl1 Values('joe','x') insert into tbl1 Values('joe','y') insert into tbl1 Values('joe','z') insert into tbl1 Values('bill','x') insert into tbl1 Values('sam','z') insert into tbl1 Values('ted','x') insert into tbl1 Values...more >>

Slow view - filter applying only at end of query
Posted by andsm at 5/5/2005 10:22:04 AM
I have view, which work good. The view has 2 query, one query union all next query. Each query is join of 24 tables. I need to do change in the view. I had, at begin of both queries: " select _id = WOrig.XpitOrderNumber*1024+OSCL.ID, ...........". Now I need to split the fie...more >>

How to kill a process when null values are inserted in infinite lo
Posted by Mike at 5/5/2005 10:08:04 AM
I have an ASP program that uploads a csv file to a temporary table. sometimes if there is an error, null values are inserted into the row in an infinite loop. When this happens I reset the server but is there a better way of avoiding this on the SQL server? a)How can I kill this process manua...more >>

LOG function ... what base, really?
Posted by Arthur Dent at 5/5/2005 9:48:30 AM
Okay, im a little confused. I just read the doc for the LOG function, and it says that LOG uses base 2. So i figured okay, LOG(8) = 3, right? cuz 2 ^ 3 = 4. Well, wrong! According to SQL server, LOG(8) is not 3, but rather 2.0794415416798357. So i thought maybe my memory of the logarithm fun...more >>

Not Exists Statement
Posted by Cathi at 5/5/2005 9:34:05 AM
I have the follow query with a subquery that is not returning the correct results, please help. The query is supopse to pull all consumers that have a specific type of step applied to the record however they are suppose to only appear if another specific type of step is not on the record. ...more >>

len(string) in where clause
Posted by Shawn Repphan at 5/5/2005 9:28:07 AM
I have two databases. One is on SQL server 2000 and one is an Access 2002. I have a table named [Data] with a field named [LName] on the SQL server. I have a table named [Names] with a field named [FullName] on the local DB. I get a data type error on this query: SELECT [LName], [FullName] ...more >>

DMO Databases uptime
Posted by Tinchos at 5/5/2005 9:01:03 AM
Hi friends.... I need to query using isqlw the SQLService uptime (Or using DMO), could anyone help me?...more >>

Bug with SQL or Ado.net....
Posted by rob lynch at 5/5/2005 8:48:08 AM
Scenario: Run a batch file.. Multiple Querys... An error occurs in 1 query and in QA all other queries will run and return results. In dot net I can't get past the error.. ie Select top 1 lastname from northwind.dbo.employees raiserror ('Error Here',14,2) Select top 1 firstname from north...more >>

If Is Null in Select Statement
Posted by Keith at 5/5/2005 8:41:07 AM
Greetings, I am getting the following error "Server: Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'IF'." My SQL statement is: SELECT dbo.tbl1.col1, dbo.tbl1.col2, dbo.tbl1.col3, dbo.tbl1.col4, IF IS NULL(dbo.qry1.col5) THEN BEGIN dbo.qry2.col3 END ELSE BEG...more >>

Should I mess with sp_tableoption?
Posted by Steve'o at 5/5/2005 8:39:37 AM
Server = SQL Server 2000 SP3a Client = Access 2000 SP3 (.adp) I was looking at sp_tableoption, and it has a couple of options which sound interesting: pintable text in row I've read BOL, but could someone clarify a little please: pintable = BOL sais [When enabled, marks the table as RAM-...more >>

Why isn't this stored proc returning data to a MicroFocus COBOL pg
Posted by Joe Palm at 5/5/2005 8:31:03 AM
We have a MicroFocus COBOL program that is calling a new stored procedure that is only called from this pgm. All data types are consistent between the two (i.e., fields are defined with the same attributes in both stored proc and COBOL pgm). But after the COBOL pgm executes the stored proc...more >>

SUM function won't work
Posted by Gary Spence at 5/5/2005 8:26:10 AM
Hi I have a SUM function in my query that's giving me the wrong value My tables are : CREATE TABLE [CurrentDataReports] ( [MachineID] [int] NOT NULL , [PartNumber] [nvarchar] (50) COLLATE Latin1_General_BIN NOT NULL , [ShotCount] [bigint] NULL , [CycleTime] [int] NULL , [Status] [int] N...more >>

Lock Records
Posted by scorpion53061 at 5/5/2005 7:34:03 AM
I apologize for the cross post but I am using ADO.NET methods and such to access SQL and I am thinking perhaps both sides will have valuable input for this. I have two tables one called QUOTEINFO and one called QUOTEITEMS. One contains the specifics of the quote and the others contain t...more >>

Which data type should be used: Varchar or Text. Survey says.....
Posted by savvy95 at 5/5/2005 7:34:03 AM
Background: I have a DB that has 5 tables (USERS, COMPUTERS, GROUPS, OU) and is populated using DTS every a.m. from Active Directory with new and modified security princpals (ie USERS, COMPUTERS, GROUPS and Organizational Units). My DTS order: 1. Copy security principal properties into...more >>

SQL Services Availability
Posted by Tinchos at 5/5/2005 7:18:02 AM
Hi anyone knows how can i check the date/time the SQLServerAgent/MSSQLServer services startup?, using WMI or consulting some properties in master or msdb? Thanks all....more >>

OSQL
Posted by A. Robinson at 5/5/2005 7:04:03 AM
I have a question with using osql. I'vce got a batch file that executes a series of SQL scripts. These SQL scripts each will take between one and two hours to execute. What I think is happening is that when one script fires off, the next in line immediately fires. How can I tell the bach fi...more >>

Data Modeling: manage events by groups
Posted by C TO at 5/5/2005 6:52:01 AM
Scenario: The system needs to manage events by groups. There is no hierachical concept in the events. Special events have different attributes that need to be treated differently so I create a separate entity. Note that the DeviceID has a many-to-one relationship with a LocationID (not in the ...more >>

Easy Query Syntax Question
Posted by Bob St. Aubyn at 5/5/2005 6:02:02 AM
Good morning, experts. Got a syntactical snag I need a fresh pair of eyes on. I've looked at this query too long and I know that the fix is probably staring me in the face but I can't see the "forest for the trees", as it were. SELECT * FROM ((SELECT XH.CDS_04 , XH.CDS_07 , XH.CDS_...more >>

SQL Procedure efficency
Posted by Stephen at 5/5/2005 3:59:29 AM
I have the following stored procedure and was wondering if anyone could help me. I've not written sql in ages and I'm not sure if i'm working efficently. I'm trying to return a dataset to bind to a asp.net datagrid and then I also want to display the total count of records in a label. Does any...more >>

Exclude weekends
Posted by Gary Spence at 5/5/2005 2:19:35 AM
Hi I have simple SELECT query SELECT StartDateTime, EndDateTime, Machines.[Name], SUM(DATEDIFF(MINUTE, StartDateTime,EndDateTime)) As Duration, Quantity ,CycleTime FROM ProductionData INNER JOIN Machines ON Machines.[ID] = ProductionData.MachineID WHERE MachineID = 1 AND Quantity > 5...more >>

JOIN
Posted by Gary Spence at 5/5/2005 2:00:02 AM
Hi, I have a table named ProdData with 2 fields startdatetime and enddatetime, Iwant to get the total downtime from another table named Downtimes between these 2 dates for each record that I extract from the ProdData table, and get it one table in SQL QA so I can execute it directly into a sp...more >>

SELECT last row(latest record) from a Database
Posted by xianxian chan at 5/5/2005 1:17:45 AM
Hi guys, how do i select the lastest record from a Database? say, if the column i want to select is called "criteria_searched", how do i select the last row that was stored? thanks in advance =) *** Sent via Developersdex http://www.developersdex.com ***...more >>

HELP with query
Posted by ngorbunov NO[at]SPAM onetouchdirect-dot-com.no-spam.invalid at 5/5/2005 1:03:42 AM
I have the following records Date EmployeeId Projec 20050503 12345 VERIZO 20050503 12345 CINGULA 20050503 12345 SPRIN 20050503 24680 CINGULA I need the resulting table to look like this Date EmployeeI...more >>

Validate bitmask values
Posted by Arthur Dent at 5/5/2005 12:18:39 AM
Hi all, I am trying to figure out a small code snippet, maybe someone has this already? I am looking for code which would validate that a value is a valid binary multiple of 2. That is, i want to validate that some number 'n' is in the sequence: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 20...more >>

Stopping the execution
Posted by Daniel Groh at 5/5/2005 12:00:00 AM
Hi i hava a procedure that call another procedure, but thie procedure just can go on processing if the called procedure has any errors. I don't know how to to this. Now when some error occurs in the called procedure, the main procedure is going on! =/ Thanks do much Daniel Groh ...more >>

What is the different?
Posted by Bpk. Adi Wira Kusuma at 5/5/2005 12:00:00 AM
What is the different, type CHAR , VARCHAR, NVARCHAR, and NCHAR? I have looked for answer at SQL Server's manual book. But I still not understand. Please explain me so simple away. ...more >>

Help to store demo users
Posted by Lara at 5/5/2005 12:00:00 AM
Hi, My table stores around 30000 users, out of which around 5-10 are demousers. Right now we are using the NOT IN Statement to list the original users like SELECT * FROM UserTable WHERE UserID NOT IN ( Demo User IDs) I know this will affect performance. Right now i am planning to modify the...more >>

Select Casesensitive
Posted by Bpk. Adi Wira Kusuma at 5/5/2005 12:00:00 AM
Example my data Name -------- adi Adi ADi AdI adI type field "Name" is Varchar(4). How to select data that its value "ADi". ...more >>

PIVOT Query
Posted by Nishanth at 5/5/2005 12:00:00 AM
Hi, I have a requirement for a query which returns as many columns as many rows are present in the table. Table looks like this Parent_Assembly_id Child_Assembly_id 1 2 2 3 3 ...more >>

Give full control on db by T-sql statement
Posted by Venkat at 5/5/2005 12:00:00 AM
Can any one give me an example to give admin role (Full access) on a database to a Role in the sql server database using T-sql statements. I am trying to create roles and users in sql server using t-sql statements. when I create a user it will be created with a permission to login to that db. ...more >>

ADP files?
Posted by Steve at 5/5/2005 12:00:00 AM
Hi, I just upsized my Access 2000 database to MSDE (which I intend to upsize to SQL Server in a few weeks) and got a .adp file from a .mdb file. How do I connect to this .adp file from Visual Basic? Can I distribute this file easily like Access? Please help, I have no idea what to do with ...more >>

Another query help question
Posted by Jack at 5/5/2005 12:00:00 AM
Similar to my other question, but the counting is different. Thank you again for your help. CREATE TABLE [dbo].[Tracking] ( [key_] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [value_] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) insert into tracking VALUES ...more >>

Locking Hints
Posted by js at 5/5/2005 12:00:00 AM
Hello, Is it common to use Locking Hints in the ADO query string? myself didn't have a chance to use it. what situation is useful to use it? Thansk. ...more >>

Script to remove all extended properties?
Posted by James Leech at 5/5/2005 12:00:00 AM
Hi Does anyone know of a way / script to remove all extended properties from objects within a certain database? Tia James tgl ...more >>

OUTLOOK message into SQL database
Posted by Kriste L at 5/5/2005 12:00:00 AM
Hi Everybody, I'm doing a program to generate newsletter and in turn need to read the = bounced email message from OUTLOOK and store these data into SQL db. = These bounced email addresses will need to be collected and for further = processing. But different ISP has different format of pres...more >>

User-Defined string Functions Transact-SQL
Posted by Igor2004 via SQLMonster.com at 5/5/2005 12:00:00 AM
Ladies and Gentlemen, I would like to offer you the following string functions Transact-SQL GETWORDCOUNT() Counts the words in a string GETWORDNUM() Returns a specified word from a string AT() Returns the beginning numeric position of the first occurrence of a character expression wit...more >>


DevelopmentNow Blog