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 > june 2005 > threads for wednesday june 15

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

Indexed views and table update
Posted by Huacuz at 6/15/2005 10:06:01 PM
Hi every one! I have a problem with an indexed view, it points to a table that need to be updated constantly, the problem is that I can update, insert and delete from Query Analizer but my ASP can not by calling a stored and it connects by ADO, not ODBC. When I take off the index from the v...more >>


Indexed views: inserts,updates and deletes on a table
Posted by Huacuz at 6/15/2005 9:59:04 PM
Hi every one! I have an indexed view that points to a table that needs to be updated constantly, the problem is that I can update, insert and delete this table from query analyzer but my ASP can not (it calls a Stored Procedure to do it), when I take off the index from the view it works pe...more >>

Comparing Dates in TSql
Posted by matthias s. at 6/15/2005 9:48:50 PM
Hi there, I've got a table with two datetime fields. Now I'd like to fetch all records with a startdate before now and an enddate in the future. Here is a part of the SProc: .... Declare @Today datetime Set @Today = GetDate() SELECT * FROM [dbo].[Campaigns] WHERE ([Active] = 1) AND (...more >>

adding foreign key doesn't get covered in a transaction sometimes
Posted by Zeng at 6/15/2005 6:01:55 PM
I ran this sql block, and if the first statement fails, then the foreign key (2nd statement) gets added to the table - it stays there even after I ran "rollback transaction" explicitly. However if the first statement doesn't fail, then the 2nd statement gets rollbacked by the bottom "rollback t...more >>

Setting Timeout duration for SqlHelper.ExecuteNonQuery ?
Posted by JeffW at 6/15/2005 5:52:45 PM
I'm using the MS Application Block class SqlHelper, specifically the ExecuteNonQuery member function to programmatically delete records from a table. I'm getting a timeout error when it runs. There can be a lot of records to delete. I can't find anyplace that tells me how to reset the time...more >>

Data Type Bug
Posted by Stu-eez at 6/15/2005 4:26:01 PM
I have discoved a bug and was wondering if anyone else has seen it. I have checked the MS Knowlegebase and do not see it listed there. In VB code, I am executing a stored procedure that passes one parameter. This works on all of my users' PCs except for one. That user is the only one tha...more >>

Batch Insert from a called Strored Procedure
Posted by Stu-eez at 6/15/2005 4:20:01 PM
I have a stored procedure that contains dynamic SQL. I want to take the results of that sp and write selected fields (for all rows) to another table. I have been trying to do this with a cursor, but have not been able to figure out how to make it work. Plus, I get the feeling that a cursor ...more >>

Fastest programmatic BCP?
Posted by R Avery at 6/15/2005 4:18:09 PM
I am interested what the fastest way to execute a BCP to SQL Server 2000 (and also 2005, if different) using VB code. I have experimented with the DTSPackage code that is automatically generated when saving a DTSPackage to a Visual Basic file in the DTS Wizard. I have also experimented wit...more >>



Number Query
Posted by Denis Crotty at 6/15/2005 4:17:02 PM
HI All, I can't wrap my head around this and it's 4:30pm so I'm hoping there is someone who can help! I have a table of points and I have been given a point. I need to query the four closest points to the one I have. So I need to find the points whose x value my point falls in between ...more >>

how to join two tables building on an existing Group By query
Posted by hazz at 6/15/2005 4:08:13 PM
The following sql works for grouping by agentUserId and a date field from the listingleads table. I would like to join AgentUserID from this table with a UserID from a User table and retrieve associated lastname,firstname fields from that User table How would I do this? Thank you! -hazz ...more >>

"Log of changes" advice.
Posted by Stanko Milosev at 6/15/2005 2:20:21 PM
Greetings from Serbia! I saw post from Edgard L. Riba, but problem with that solution is that every change on table I should change trigger too. I wanted to ask, is there possibility that somehow MS SQL Server automatically log who changed what? Also, I would like to read, how you peopl...more >>

Where Not IN
Posted by Elmo Watson at 6/15/2005 2:05:44 PM
Here's the scenario - I've been migrating multiple tables to one - - I have only two left over now I need to select ONLY those records/people from the first table who have not updgraded, and therefore been entered into the second table. I know this does not work: Select Name, Email from Fir...more >>

Export data to a flat file on a share
Posted by AsaMonsey at 6/15/2005 1:47:05 PM
I have a SQL Agent job that calls a script that results in two xp_cmdshell operations. One calls bcp out, and a second calls echo to create a blank signal file. Both files are created on a network share over which I have little control. My problem is that I now need to allow users to fi...more >>

JOIN
Posted by Denis at 6/15/2005 1:40:39 PM
I've 2 tables DB_Transactions ID Ordini 1 10,11,12 2 13 3 14,15 DB_Orders IDOrdine Servizio 9 s0 10 s1 11 s2 12 s3 13 s4 14 s5 15 s6 .... 20 s10 ...more >>

default column value
Posted by simon at 6/15/2005 1:34:01 PM
Can I set default value on table column to some value in other table, for example: default="SELECT value from settings where id=1" regards, Simon ...more >>

Multi Rows into One
Posted by Stan at 6/15/2005 1:10:12 PM
I am using SQL to extract data to a text file(and I'm new to this). I want to end up with one row from a table that stores data in two rows: Table looks like this: Location LocationTYpe Product 1111 Bottle AAA 2222 Case AAA I want my file to l...more >>

stored procedure problem and alter table statements
Posted by Chris at 6/15/2005 1:09:01 PM
Hi, I have created a stored procedure with dozens of SQL statements. The statements are combinations of SQL statments followed by alter table statements: creating new fields. example: one SQL statment creates a table from other tables. next statements are alter table statements creating n...more >>

What is the best way to form a string using returned integers?
Posted by Andrew at 6/15/2005 1:01:07 PM
Hello, friends, In a stored procedure, I need to select release IDs (Integer data type) and convert them into a comma delimited string (varchar data type). For example, SELECT releaseID FROM release WHERE releaseName LIKE '%SALES5' suppose we have 1134, 1001, 1231, 1471 returned from th...more >>

Row insertion date
Posted by MaxiWheat at 6/15/2005 12:49:47 PM
Hello, I have a table in which we hold our company news (facts, tips etc..) with an Identity primary key .. until now no datetime column was holding the date on which a row was inserted (default to GETDATE()) ... but we want to add a new column that will do so. The thing I want to know is : I...more >>

Where should the files go?
Posted by Chris Lieb at 6/15/2005 12:48:01 PM
In my DTS packages, I am accessing files that are contained on the same machine as the SQL Server. Is there any performance benefit by placing the files that I am going to be working with on the SQL Server instead of having them on a local machine? -- Chris Lieb UPS CACH, Hodgekins, IL ...more >>

Programmatically rename a table
Posted by Bill Le May at 6/15/2005 12:17:17 PM
In order to upgrade a customer's database schema in the field, we want to have a VB program that will rename certain tables. I tried this: Set rsSchema = DBConnection.OpenSchema(adSchemaTables) Do Until rsSchema.EOF If rsSchema!TABLE_NAME = "this" Then rsSchema...more >>

Indexing and Count(*) statements
Posted by quiglepops at 6/15/2005 11:46:04 AM
I have a huge table. When I do a select count(*) from table it takes forever, would I be correct in saying that no indexing in the world is going to help me in a count(*) query (the * being the problematic part which enforces a table scan). ...more >>

Group By Week
Posted by David C at 6/15/2005 10:35:45 AM
I have the following SQL to get total minutes worked by date. Is there a way that I can return these same totals by week? e.g. Sunday through Saturday? Thanks. SELECT EmployeeCode, DateEntered, SUM(MinutesWorked) AS Minutes FROM dbo.RepairOrderTasks GROUP BY EmployeeCode, Date...more >>

TSQL question: not in doesn't work...
Posted by dfate at 6/15/2005 9:51:44 AM
Hi, Does anyone know why this doesn't work? select distinct contno from speakers where speakers.projectid in ('CRM0077644','CRM0133885','CRM0202623') and speakers.contno not in (select contno from genie.dbo.user_genie) the statements work individually. All of the columns are char(10) in ...more >>

Help with an Update / Inner Join Query
Posted by mitch at 6/15/2005 9:25:08 AM
Hi, I am running Microsoft SQL. I am trying to run this query in the Query Analyzer: UPDATE instructor INNER JOIN security ON instructor.name = security.user_name SET instructor.userid = security.userid Where instructor.name = security.user_name I get this error: Serve...more >>

Unexplained Rollback commands
Posted by Bryan at 6/15/2005 8:47:10 AM
I'm running an application which is doing lots and lots of inserts into many tables in a SQL server database. The inserts are coming from C# code which is using Microsoft's SQLHelper class and is passing through a connection string and the actual SQL to do the insert (no stored procedures are...more >>

Separate string concatenated by '-'
Posted by Matthew at 6/15/2005 8:32:10 AM
Data in a varchar column has the below format: 700-10-1-20010301, 1500-XYZ-10-20050401-ABC, 30-50-1... How can I get every part without '-'? 700 10 1 20010301 1500 XYZ 10 20050401 ABC 30 50 1 Thanks in advance....more >>

Query Help: A day ledger - need to know what products people spend their first $n on.
Posted by Wangkhar NO[at]SPAM yahoo.com at 6/15/2005 8:13:48 AM
The table I'm working from is around 100million records, these are the relevant columns from it - it's like a day ledger, we need to know what products people spend their first $n on. ddl: create table #t1 (ledgerId int not null identity, personId int not null, prodType int not null, amo...more >>

Query Question
Posted by Ash at 6/15/2005 8:01:05 AM
Hi all, This my table.. TO FROM DISTANCE A B 100 B A 100 C D 200 D C 200 E F 300 F E 300 I want to select all unique segments between point x and point y (ignoring direction)Ie result would be TO FROM DISTANCE A B 100 C D 200 E F 300 OR TO FROM DISTANCE B A 100 D C 200 ...more >>

qry help
Posted by Arul at 6/15/2005 7:50:06 AM
I have the following data set; id type location value 101 FAX OFFICE 1234 101 FAX OFFICE 2343 101 PHONE HOME 09989 101 PHONE HOME 97909 I'm trying to write a query that will retrieve the above data set like shown below; id type location value1 value2 101 FAX OFFICE 1234 2343 101 PHONE...more >>

Trigger Happy
Posted by Tim Baur at 6/15/2005 7:29:39 AM
I am at the initial stages of a project, and have a general question about design. My application will have a business logic layer - either dot net or com, and a SQL Server database layer. I've always been a big fan of triggers, and I employ them with every opportunity I see. Whenever I h...more >>

xp_sendmail + send out as Excel attachment
Posted by LBT at 6/15/2005 6:58:10 AM
Hi experts, I would like to retrieve records from database and send out to recipients as Excel attachment using xp_sendmail. Is there any way to arrange the respective columns nicely into the particular column of Excel sheet? Previously I send out the records by using text attachment fil...more >>

Prob with Insert Into Temp table twice within stored procs
Posted by KCSL at 6/15/2005 6:30:01 AM
Attempting to compile this proc give the error: There is already an object named '#temp' in the database. Is there any way around this. (Of course this isn't the real proc, but this example shows the problem) create proc joe as begin select individual_id into #temp from individual...more >>

COM+ SQL Server Deadlock Issue
Posted by Tim Robe at 6/15/2005 5:09:03 AM
I have an issue with a COM+ transaction running against SQL server that consistenty results in a deadlock. The transaction is fairly simple - it is trying to assign a work unit to a process by setting a value on the table called work_item by setting a value called lock_workstation_name as foll...more >>

Unicode characters Getting converted to other chars in DTS Package
Posted by Sevugan at 6/15/2005 12:28:04 AM
Hi, I have created a DTS Package. This package exports the data of a table to a flat file. One of the columns of the table contains some unicode characters. After the data is exported to the flat file, it does not contain the same unicode characters that were originally present in the tab...more >>

DELETE FROM ... - no table aliases?
Posted by Kim Noer at 6/15/2005 12:00:00 AM
Hi there ... I bumped into a problem, which points in the direction, that having aliases for tables, doesn't work in a delete from clause. Is that correct? Example : delete from table1 as tb1 join table2 as tb2 on tb2.field1 = tb1.field1 where tb2.field1 = 'bla bla' and tb2.field2 = ...more >>

Need for speed for stored proc
Posted by Lisa Pearlson at 6/15/2005 12:00:00 AM
Hi, I have the query below that seems to be slow.. I use QA to analyze the query plan but I don't know how to analyze it as nearly all processes show 0% cpu load. I had an older version of this query that was much faster (not if I execute it in QA, only matter of seconds it seems, but it...more >>

Search table performance
Posted by Richard Hollis at 6/15/2005 12:00:00 AM
I have several tables that are searched for either LIKE text matches or integer values for my website. Previously the search used a large unioned query to search the 9 tables with all the relevant WHERE clauses that were applicable to the searching. I then created a table and inserted the reco...more >>

Merging Tables Query
Posted by Daren Hawes at 6/15/2005 12:00:00 AM
Hi, I have a table with 4 Columns and one with 1 coloumn. Both tables contain 1000 rows. Table 1 row 1 = table 2 row 1 as far as corresponding data. I need to insert Table 2 row 1 into Table 1 row 4. So in summary can anyone help me merge some data into an existing table but not by appendi...more >>

Is there anyway to find when the sps are modified
Posted by lara at 6/15/2005 12:00:00 AM
Hi, Can anyone suggest me a way to find the last modified sps and tables ...more >>

.Net custom resolver
Posted by msnews.microsoft.com at 6/15/2005 12:00:00 AM
Can anyone point me towards a source code listing for a working replication custom resolver written in .Net (C, VB etc dont mind which)? I just need the skeletion of it and not the actually implementation of the conflict resolution. cheers ...more >>

temp table creation with dynamic data types? is it possible?
Posted by Zarko Jovanovic at 6/15/2005 12:00:00 AM
hi all, I want to create temp table (local) like this: ------------------------------------- declare @v int set @v=5 drop table #temp_table if @v>1 begin create table #temp_table (a int) end else begin create table #temp_table (a char(1)) end ----------------------------------...more >>

problems with xp_trace_addnewqueue
Posted by Pushkar at 6/15/2005 12:00:00 AM
Hi I have stored procedure that calls xp_trace_addnewqueue with proper parameter. It returns 0(Success) when executed as normal stored procedure, but return a error code 31 when executed as startup procedure. I don't what the error 31 signifies. Please help me to get through it. Thanks...more >>

Server Side Trace does not work when created as start up procedure in SQL Server 7
Posted by Pushkar at 6/15/2005 12:00:00 AM
Hi I have created a stored procedure that start a trace and save the result to a table. Procedure works fine when I excute the procedure from query analyzer. But when I make that procedure as startup procedure, it does not start the trace. I am not able to understand why is it behaving so....more >>

How to get queue handle by queue name
Posted by Pushkar at 6/15/2005 12:00:00 AM
Hi I have a trace in SQL Server 7 that starts with the server start up. I know the queue definition name, but i don't the queue_handle. I need the queue_handle to stop the trace if required in between. Thanks in advance. Pushkar ...more >>


DevelopmentNow Blog