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

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

insert records dependent on values from other table - with a logic
Posted by Xavier at 9/7/2005 10:55:01 PM
hello, can somebody show me please how to solve this structure of the first table id (primary key) f1 (varchar field) nr (numeric field with values from 1 to 100) structure second table id2(autonumber) id (integer value ) f2 (varchar field) the value from table 1 have to be insert...more >>


SQL 2005 and DateTime fields
Posted by Ben Kim at 9/7/2005 9:34:09 PM
I am playing with the CTP if SQL 2005 and loving it. However I was under the impression that this new SQL server version WOULD support separate date and time fields. Is this planned as a last minute change before release? Reasons to have separate DT fields: 1. Tracking dates where we cou...more >>

first user liberates
Posted by Frank Dulk at 9/7/2005 8:44:47 PM
When an user opens any form to alter some given, if or user to open the same screen and to try to consult the same registration everything is joined until that the first user liberates. However, the times an user is in the office and the other in the branch, the second is without to know that is ...more >>

Loading an XML file directly into SQL server in C#
Posted by Brian Kitt at 9/7/2005 8:11:08 PM
I have a 250 MB XML file that I need to put into a SQL server database. I remember years ago I did something in VB where I could stream a .CSV file straight into an Access Database. I can't remember how I did it though. There should be a really slick way to bring an XML file directly into S...more >>

Generating an Index
Posted by Mary at 9/7/2005 6:55:45 PM
Hi, I need some assistance with a query. To be honest, I'm not even sure it can be done. I'll try to keep the information limited to only what's relevant to what I have and what I am trying to achieve with this query. I have a table that contains around 100,000 records. For the sake of this...more >>

Am I correct?
Posted by Ed at 9/7/2005 6:53:01 PM
I read the message with the subject "Can I recover?". It states that the user only has a copy of the database backup in February and he executed an update statement without a where clause. He wants to know if it can be recovered... From what I know, if the February backup was a Full backu...more >>

Finding out if a table exists in an ad hoc query
Posted by RSH at 9/7/2005 5:34:29 PM
I'm trying to write a query that I can fire off from my VB6 application to see if a table exists in SQL Server. I have found several that use multiple lined Transact SQL but the error out on me. Is there a simple query I can use suitable for passing through an ADO command string? I ne...more >>

complicated update (for me)
Posted by jason at 9/7/2005 4:28:52 PM
hello everyone, just having trouble with an update statement. so i started off with a table like so: create table foo ( id uniqueidentifier not null primary key nonclustered, name varchar(50) not null, type int not null, datecreated datetime not null default getdate(), constrai...more >>



table update trigger update second table
Posted by Cynthia at 9/7/2005 4:20:04 PM
I am trying to write a trigger that will update the field linedescription in my commondata table depending on what is entered or changed in the field specname in my components table. I created the trigger below, but it does not work??? Please help? CREATE TRIGGER [EleSpecInfo] ON [Compone...more >>

Using Lotus Notes and XP_SENDMAIL
Posted by LITO at 9/7/2005 4:16:01 PM
Can I trigger the xp_sendmail using Lotus Notes? What do I need to get this going? TIA -- Lito D...more >>

Scripting on SQL Server
Posted by MittyKom at 9/7/2005 3:39:03 PM
Hi All I have been told to write a script that runs the following statements on a production sql server database: Use Db1 Go UPDATE dbo.tb12 SET ColNotified = 1 WHERE Status ='A' Go I dont know where to start from and where to even look to do all this. Pls hlp. Thank you i...more >>

Query Against XML File (not just XML data)
Posted by Jeremy S. at 9/7/2005 3:38:13 PM
In BOL I've been reading up on OpenXML, sp_xml_PrepareDocument, OpenRowSource, OpenDataSource, etc, but have not yet found a way to link to and query an XML file. What I'm looking for is something like sp_xml_PrepareDocument that will let me read an XML file from disk. Suggestions? Thank...more >>

Changing Results View in Query Analyzer
Posted by footyplayer at 9/7/2005 3:18:36 PM
A week ago, I had to change my view to 'Results in Text' in SQL Query Analyzer. All I did was choose 'Results in Text' from the menu and ran my query. Now, whenever I open SQLQA, it always puts the results in text, instead of results in grid (which is what I want). I've looked in the opti...more >>

Change my query please
Posted by Sehboo at 9/7/2005 3:14:19 PM
I have two tables, one with basic info about employee and the other one with hierarchical data (employee ID, supervisor ID) Following query returns the name, id and child count. Problem is that it returns the entire table. I am only interested in records whose supervisor id is 55 (or whate...more >>

handling foreign characters
Posted by JD at 9/7/2005 2:52:54 PM
I have a database that will be accepting foreign characters from different languages, as in Germany, Russia, Japanese, Chinese and so on. I was wondering if there was anything different you need to set up on the database for this to work properly, as I am currently working in a database and an...more >>

Remove 2nd Log file
Posted by pmattson at 9/7/2005 2:36:12 PM
Hi all, I've got a SQL 2000 SP4 server with a database that has 3 data files and 2 logs files. I no longer need the 2nd log file and I would like to remove it. How is this best accomplished with no or at least extremely minimal downtime. Is it done the same way I remove a data file? D...more >>

Using SQLDMO for Changing Identity Column
Posted by Marcel Gnoth at 9/7/2005 1:51:23 PM
Hi, How can I change the Identity Property of a column for an existing Table which contains data? I also need to change Seed and Increment. If I change the Identity Property of a column Object then I get the Error: [SQL-DMO]Modifying existing table column is not supported through this ...more >>

Can I recover?
Posted by Patrick Nolan at 9/7/2005 1:01:47 PM
An update statement was made against a table that did not include a 'where' clause and hence all the records were updated and basically destroying all the data. There is no recent backup of the database ( the last one was in February). Is there anyway to get back to the the way the table was bef...more >>

truncate tables with foreign key references
Posted by Jason at 9/7/2005 12:55:24 PM
Hello, How can i truncate tables where there are references to foreign keys? Normally is use the truncate table statement. Anyone knows a simple solution for this. Thnx...more >>

Dropping all foreign keys
Posted by Andy at 9/7/2005 12:47:05 PM
I would like to have a procedure that I can call that will drop all foreign keys. I can get the constraint name from sysobjects if I select all fkey constraints, but how can I get the associated table name so that I can plug that into an alter table statement? I appreciate any suggestions....more >>

select
Posted by David Kwon at 9/7/2005 12:30:35 PM
Does anyone know how to make a store procedure that takes a string and concatinate with another string to form a table name. For example, I have a table name 'tape001' and 'tape002'. I have a store procedure name spShowTape. I want to print results from table tape001 by calling 'exec spS...more >>

Join with Subselect and Sum
Posted by MEG at 9/7/2005 12:16:03 PM
I have an appointment table (appts) and a charge table (charge). For the day the query is run, I want to return anyone with an appointment that has a balance on the charge table. I am looking at doing a subselect but I'm having a syntax problem. select APPTS.ACCOUNT from APPTS wh...more >>

drop index
Posted by js at 9/7/2005 11:38:35 AM
Hi How to check the indexname is exist in the table (WHERE name = mytable.indexname)? IF EXISTS (SELECT name FROM sysindexes WHERE name = mytable.indexname) DROP INDEX mytable.indexname Thanks. ...more >>

SQL Transaction Question
Posted by Yosh at 9/7/2005 11:25:52 AM
I hope this makes sense and is not too general. I have a stored procedure where I use cursors. I would like to wrap a = code block making it part of a BEGIN, COMMIT, and ROLLBACK transaction.=20 Is there a certain recommended way to do this? Thanks, Yosh...more >>

computed value
Posted by Lynn at 9/7/2005 11:20:03 AM
I've added a column to my table as a computed value, pretty much only to populate it for the existing data. I want to do this, then drop the computed value, make it's new column NOT NULL and lay over it a unique constraint. Can I drop the computed value w/out dropping the column? -- Lynn...more >>

sql to perform a remote backup on another server
Posted by Don at 9/7/2005 11:01:04 AM
Hi, I have two servers MM1 and MM2 each with a database named DBA. I want to create a Multi step job on MM2 that will backup MM1 DBA and restore it on MM2 DBA. I can code the restore SQL on the MM2 DBA, but how does one code the job step on MM2 to backup a the DBA database on MM1. The...more >>

DECLARE Table
Posted by Dimitris Milonas at 9/7/2005 10:18:22 AM
Can anyone give me an example on how to use DECLARE to create a table variable? Thanks in advance Dimitris ...more >>

Employee Hierarchy Query
Posted by Sehboo at 9/7/2005 9:50:50 AM
Here are my tables CREATE TABLE Employee ( Employee_ID [int] IDENTITY (1, 1) NOT NULL , Name varchar(30) ) CREATE TABLE Employee_Hierarchy ( Employee_ID [int] NOT NULL , Parent_Employee_ID [int] NULL) I need a query where given an employee_id, it should return the name of all the...more >>

tricky select Count
Posted by JP at 9/7/2005 9:40:03 AM
I have a table with Names and Dates in it. AppName Date App2 9/6/2005 11:22:38.00 AM App2 9/5/2005 09:18:23.00 AM App1 9/6/2005 11:22:23.00 PM App1 9/6/2005 04:09:11.00 PM App2 9/4/2005 08:01:17.00 AM I need a select statement tha...more >>

Stored Procedure Totaling
Posted by Mystryman at 9/7/2005 9:39:04 AM
Here is what I am wanting to do. I have webpage that displays a report. The users can choose to show a single day(past or present) or a range of date. What I would like to create is a stored procedure that I can pass a start date and an end date. based on the values passed, return the appropr...more >>

SQLDMO failing to enumerate sql servers in vb
Posted by Brian Henry at 9/7/2005 9:38:01 AM
Anyone know why this would happen... I added a reference to the SQLDMO COM object, imported it on top of my code.. then this test code fails Imports SQLDMO Module Module1 Sub Main() Dim i As Integer Dim oNames As SQLDMO.NameList Dim oSQLApp As SQLDMO.Application oSQLApp = New ...more >>

incremental copy of a database from source to destination
Posted by chieko at 9/7/2005 9:27:04 AM
Hello, Thank you for reading my message. I would like to copy data from one database that gets its tables truncated every three days to an another database that will act like an archive of the first database. I tried using the differential backup strategy but it did as I expected only backe...more >>

This Pivot code doesn't work in SQL Server 2000
Posted by J.S. at 9/7/2005 9:03:09 AM
I created a table in SQL Server 2000 with this code: CREATE TABLE Sales_Order (Customer varchar(8), Product varchar(5), Quantity int) and then entered some values. Later I tried to use this PIVOT code: SELECT * FROM Sales_Order_ PIVOT (SUM(Quantity) FOR Product IN ([Bike],[Chain])) AS ...more >>

help with DB corruption
Posted by PP at 9/7/2005 8:44:02 AM
I'm running dbcc checkcatalog('DB') and I'm getting the following error: Table error: Object ID 98815414 (object '98815414') does not match between 'SYSCOMMENTS' and 'SYSOBJECTS'. I have checkcatalog with repair_allow_data_loss but it doesn't fix it. I have also used checkdb and checktable...more >>

inner joins
Posted by michaelnewport NO[at]SPAM yahoo.com at 9/7/2005 8:03:59 AM
Greetings, I like to write my inner joins as below, but someone at work tells me its not as 'performant' as using the 'inner join' statement. Is this true ? Is there a better way to write it ? thanks Mike SELECT count(*) FROM resources a, assignments b, timesheets c, timesheetpayr...more >>

Need advice on searching text fields
Posted by Brian Kitt at 9/7/2005 7:58:31 AM
I have a table with 2 million + rows. I need to allow the user to do a query such as is shown below. I have full text search enabled on this database, and have built a text search catalog for it. The problem is, that I keep getting timeouts on the query. Granted, I can increase the timout ...more >>

Table Size
Posted by SalamElias at 9/7/2005 6:09:04 AM
Is there a quick way or a SP to know or calculate the size of a table in a SQL database Thanks in advance Salam...more >>

One last xp_cmdshell Q (sorry)
Posted by marcmc at 9/7/2005 5:46:10 AM
I run the below on the box that has psExec installed as sa (dbo) in QA. The MSSQLSERVER service is set to Local Account. Domain\Administrator will run c:\psexec \\10.2.27.230 -I cmdmgr_Resume.bat from a CmdExec job sucessfully. I run same from command prompt successfully. Do I have to set MSSQL...more >>

Locking a Table
Posted by Chan at 9/7/2005 5:19:02 AM
Hi All I have a procedure which runs to do various tasks but I have one particular task which reads maximum numbers from two tables (one current one history) and then takes the highest of those two numbers and increments it to get the ID number used to insert a new row into the current tabl...more >>

name a default constraint upon creation
Posted by Rippo at 9/7/2005 4:53:46 AM
In QA I can alter a table with ALTER TABLE dbo.Incidents ADD NewIncident int NOT NULL default 0 However later on I wish to remove the default on this column. However upon creation the defualt is given a name like DF__Incidents__NewIn__05D9AC15 Can I a) Give a name to the default upon cr...more >>

Spooling_SProc_to_file_using_iSQL_and_xp=5Fcmdshell_changes_=A3_(GBP)_to_oe_symbol
Posted by RobJH at 9/7/2005 3:39:43 AM
Hi, I have been using the isql command via the xp_cmdshell in MS SQL for some time now for the purpose of creating pre-formatted articles for our press department (saved as .xtg format files for input into Quark). This works extremely well, and any "PRINT" statements in the sp are spooled o...more >>

Problems with INSERT
Posted by narina at 9/7/2005 2:55:54 AM
Hello, I have a problem with creating INSERT statement. I have 3 tables, which look something like these: PLANS ------ id_plan ..... TasksOfPlan ------------ id_tasksofplan id_plan task DETAILS ------- id_details id_tasksofplan date hours All ID's are autonumbers. I wa...more >>

Query Performance
Posted by Ghulam Farid at 9/7/2005 2:51:43 AM
HI to All! Is there anyway to improve the performance of Queries involving Substring clause. i have indexes on the query columns but performance is not good. e.g if i use a query without substring it gives me result in less than 1 seconds over a more than 1.3 million rows and when i use subs...more >>

Another instance to develope on.
Posted by Craig HB at 9/7/2005 2:25:14 AM
At the moment, we don't have a development server and develop on our production server. We develop on "DEV_MyDatabase" and then deploy changes to "MyDatabase". This has 2 problems: (1) linked views from other databases have to change, and (2) sometimes we accidently go into the wrong data...more >>

NOT FOR REPLICATION when manually replicating data
Posted by jason.l.strauss NO[at]SPAM gmail.com at 9/7/2005 1:49:40 AM
Hi folks! I am wondering if anyone out there has been able to use the NOT FOR REPLICATION field constraint when implementing a manual replication process? From what I have read, only the inbuilt replication methods can actually insert identity fields without SQL Server happily updating it's i...more >>

Columns Order
Posted by Ahmed Hashish at 9/7/2005 12:00:00 AM
Dear All Can I Alter tables to change the columns orders, Or Add Column in a specified order? How? Ahmed ...more >>

Accessing SQL via http
Posted by Lost and Confused at 9/7/2005 12:00:00 AM
Hello, Apologies if this is in the wrong newsgroup... I have followed the tutorial in Books Online that is called "Creating the nwind Virtual Directory". Everything looks ok but I get an error that says: - "HTTP Error 404 - File or directory not found. Internet Information Services (IIS) whe...more >>

Multiple table query
Posted by Brian at 9/7/2005 12:00:00 AM
I just inhertied a database. In it are multiple tables that keep track of a users profile. In each table is a modified_date field. That date only relates to that table and not the entire profile. There was never a central modified_date for the user. I need to be able to check the users ...more >>

SQL counter
Posted by Denis at 9/7/2005 12:00:00 AM
Hi I've a varchar field and I need an SQL to get all the rows where this field has 2 points Field1 row1 pippo.it row2 pluto.venice.it row3 minny.ba.it In this case row2 and row3 Can you help me? thanks ...more >>

Calculating date for first day of week by week number
Posted by Sune Hansen at 9/7/2005 12:00:00 AM
Hi all, Is there some way to calculate the date for the monday (monday is first day of week where I live) of a given week? I.e. given the week number 36 the function should return September 5th, 2005. Regards. Sune ...more >>

Test post
Posted by Rob Nicholson at 9/7/2005 12:00:00 AM
Test post - please ignore. For some reason, when I joined this group, Outlook Express didn't show any messages. Cheers, Rob. ...more >>

Join expression or where expression - which is more efficient?
Posted by Rob Nicholson at 9/7/2005 12:00:00 AM
Consider the following two queries which are return identical results. The only difference is that in #1 the expression to limit the records matched against UserProperties is performed in the where clause whereas in #2 it's carried out in the join. Is one anymore efficient than the other? I ha...more >>

Sp Dependencies for a table
Posted by Hasan O at 9/7/2005 12:00:00 AM
Hi, I want to write a sp which gives me the relation between a table and the stored procedures which belong to that table. I mean, lets say USER table and GetUserDetail ( select * from USER where ......) sp exist. GetUserDetail is dependent on USER table. How can i get stored procedure...more >>

Program Error establishing a debugger session with the server. See debug log for more information.
Posted by mhw at 9/7/2005 12:00:00 AM
Program Error establishing a debugger session with the server. See debug log for more information. Why? What do I should? Thanks! ...more >>

Executing SQL clause in extended stored procedure
Posted by ggeshev at 9/7/2005 12:00:00 AM
Hello, I have a question about the executing of an SQL clause in xp(extended stored procedure). I saw the examples about the ODS: xp_gettable_dblib and xp_gettable_odbc. When I call xp_gettable_dblib, this xp execute the SQL clause in session, which is different from the session from which it i...more >>


DevelopmentNow Blog