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 > december 2004 > threads for monday december 20

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

Delete Data Without Log
Posted by Yash at 12/20/2004 11:49:01 PM
Hi, Is there any way to delete specific records from a table with out generating the transaction logs. -- Regards, Yash ...more >>


Retrieving Data in XML Format
Posted by Leila at 12/20/2004 7:55:11 PM
Hi, I use nested loop with inner joins to retrieve organization's chart from EmployeeID-ReportsTo columns. Our client uses XML and I must send the chart in XML format. How can I perform this? Any help would be greatly appreciated. Leila ...more >>

How to find non-referenced columns in a database
Posted by Ada at 12/20/2004 6:57:03 PM
Hi All, We have a huge, complex, poorly designed database in Dev. and I need to find if there are non-referenced columns, which are defined on multiple tables, in this database. I can get column info from INFORMATION_SCHEMA.COLUMN view and FK info from REFERENTIAL_CONSTRAINTS view, but...more >>

Using COUNT() with CASE
Posted by DC Gringo at 12/20/2004 6:39:42 PM
I getting an error: "Server: Msg 195, Level 15, State 10, Line 14 'Count' is not a recognized function name." How else can I correctly use the COUNT aggregate around this CASE statement: SELECT distinct clnGUID = '', Community = '', Impact = '', Round(Avg(PopulationKeyInfo),1) as Popul...more >>

help with aggregates
Posted by DC Gringo at 12/20/2004 5:37:52 PM
I am unable to get what I want out of this query. I am looking for. It seems that I'm getting aggregates (average) from the whole view and not the average of the queried data that is a result after the where clause is applied. What am I doing wrong? SELECT distinct clnGUID = '', Community...more >>

Relation to a table name
Posted by Henrik Skak Pedersen at 12/20/2004 5:08:13 PM
Hi, I would like to create a relation based on a table name. I have a table schema like this Table A ----------- Id Desc Table B --------- Id Desc Documents -------------- TableName Id Records in Documents --------------------------- TableName Id ----------- ------...more >>

learning strategy
Posted by Paul Pedersen at 12/20/2004 4:30:52 PM
I'm pretty new to SQL Server. I know there are a lot of SQL2000 (and 7 and even 6.5) installations out there; OTOH, I like being up to date, especially not learning stuff that will be changed in the new version. Should I learn on SQL2000, or download the beta of SQL2005 and learn on that o...more >>

I need your help, thanks in advance!!
Posted by BFG2000 at 12/20/2004 4:14:28 PM
CREATE TABLE [dbo].[_z] ( [ID] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [YEAR] [int] NOT NULL , [COUNT] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[_z] ADD CONSTRAINT [PK__z] PRIMARY KEY CLUSTERED ( [ID], [YEAR] ) ON [PRIMARY] GO INSERT _z VALUE...more >>



SQL query
Posted by viktor at 12/20/2004 4:12:17 PM
Hi, How can i select item and price from the last date date item price 12/11/02 11150PBCAD $0.00 Y 9/4/03 11150PBCAD $60.00 Y 8/11/04 11150PBCAD $60.00 Y 10/7/03 11150PBCAD $60.00 Y 5/5/04 11150PBCAD $60.00 Y 3/24/04 11150...more >>

Cross SQL Server Triggers
Posted by Jason Bennett at 12/20/2004 3:43:07 PM
Hello, I am trying to replicate some data to a disparate location from our current SQL server. Both locations are accessable in Enterprise Manager, but exist on separate SQL servers. I have a "master" database that is the record of source for vendors and customers, and when new vendors ...more >>

Triggers
Posted by Miles Cousens II at 12/20/2004 3:42:23 PM
Currentnly I have one trigger on a table in Database A that populates a table in Database B. The table in Database B also has a trigger that does a lookup from a table on Database C that is located on a different server. The servers are connected using the sp_addLinkedServers. The problem I a...more >>

separating last name from first name in "name" field
Posted by sean sobey at 12/20/2004 3:28:59 PM
Hello everybody, I have a field called "name". Data in this field looks like this: john Doe jane harriet Doe mark h brown I am moving this "name" field data to another table. The new table has fields for first name, middle initials and last name. How can I separate and export/import...more >>

Trigger question
Posted by MichaelK at 12/20/2004 3:21:06 PM
I have the ProcessDate field in the table. When this field is updated I want to set a trigger, which will update Process1Date field on the same record with ProcessDate + 30 days and Process2Date field with ProcessDate + 60 days. Thanks, Michael ...more >>

Timeout when inserting BLOB records
Posted by Mike Green at 12/20/2004 2:59:47 PM
Hi I have a problem with a VB application that is adding tif images as BLOBs to rows in a table in SQL2000. At present the system is failing as the application cannot insert records to the table. Constantly receiving timeout errors. Images can be retreived from the table with no problems. ...more >>

User-Defined Function or Stored Procedure?
Posted by Scott M. Lyon at 12/20/2004 2:58:50 PM
I've got a specific case where I'm at a loss to figure out which would be better to use: a stored procedure, or a user-defined function. I need a SP/function that will take a few parameters (including PartNumber - a varchar(50) and FormulaCode - a varchar(1) ), and will return a calculated v...more >>

how to configure smtp server with sql server?
Posted by === Steve L === at 12/20/2004 2:57:03 PM
can anyone tell me how to use smtp server as a mail client for sql server notification? how to configure that in sqlagent property? thank you!! (sql2k on nt4) Steve :) ...more >>

Searching Question
Posted by AGB at 12/20/2004 2:12:00 PM
Is it possible to search a database for certain text values? More specifically, I have a value that is in some table somewhere in a huge database and I need to find where it is stored. Is there some sort of searching mechanism to allow this without having to open each table? Thanks ...more >>

Report slows down other applications
Posted by Helen Stein at 12/20/2004 1:18:37 PM
Hello, I wrote a report in COBOL using embedded SQL. This report opens 5 insensitive cursors (to avoid locking) sometimes one within the other to access data. 5 tables accessed by this report used in the mission critical applications that require high performance and speed for insert, update ...more >>

How to join two tables and only display the values on the first row?
Posted by Alfredo Becerril at 12/20/2004 12:45:46 PM
Hi all, I need to join two tables but the joined table must be displayed only in the first group's row... Table 1 FieldID Value1 Value2 LookupField 1 A B N1 2 C D N1 ...more >>

Changing to Fiscal Year
Posted by J. Joshi at 12/20/2004 12:45:36 PM
As I see, the default values from the datepart function results in Calender Year Quarters/Months". Our business deals with Financial Year from July01 Through June30th. The question(s) I have is: 1. Is there a way to change the default setting of a definition of a 'year'? Whereby using st...more >>

Storage Impact of nullable varchar column?
Posted by Bill Henning at 12/20/2004 12:10:05 PM
Hi there... I have a couple quick questions. I'm making a table where there an be either a numeric value or a text value stored. So I need two columns like this where both are nullable: EvaluationScore tinyint EvaluationComments varchar(1000) My questions are: 1) Does the size of the...more >>

Bigint fields and Access
Posted by David C at 12/20/2004 12:07:28 PM
I am using Access 2002 and connecting to SQL Server 2000 using ODBC attached tables. I have to change one of my SQL Server table fields to a BIGINT data type. How am I going to set a variable in Access to handle a bigint field as I think the largest field type is Long. Thanks. David ...more >>

Hierarchy Problems
Posted by Kevin Munro at 12/20/2004 11:39:29 AM
Hello, I'm having a problem with hierarchies. I've got a simple parent child relationship as defined below and I'm wanting to return rows from a specified child to the root node. e.g. if I look at Orange I want three rows returned (with columns of ident and n) --7,Orange --2,Fruit --1...more >>

Updating SQL table from front-end Access
Posted by SharonInGa at 12/20/2004 11:29:02 AM
I'm using Access as a front end to SQL. Our product ID (key field) in the Product Name table sometimes changes. I need all of the associated records in the SQL Order table to change when a product Id is changed. What is the best method to use? VB on an event -- or -- Run a SQL stored pr...more >>

Need help w/ SELECT statement within a SELECT statement
Posted by Sam at 12/20/2004 11:28:37 AM
Hi, I've included SQL scripts at the bottom of this message so that you can create the database if you need to. It only has 3 tables. I need help writing the SQL statement that gives me marketing performance data for sales personnel. There are 3 tables: 1. tblEmployee is for Employee da...more >>

Syntax for setting primary key
Posted by Morten Snedker at 12/20/2004 11:26:27 AM
I have an existing field which i wish to alter to being primary key. I can't seem to get it right. This is what i'm tumbling with: ALTER TABLE tblFJV_Tilsagnsramme ALTER COLUMN RammeJournalNr nvarchar (10) not null CONSTRAINT jrnnr_pk PRIMARY KEY Thanks in advance. /Snedker...more >>

Comparing view structures
Posted by Andy at 12/20/2004 11:07:09 AM
In my environment we create a new view each month for our data. The views are created by a DTS package which calls a stored procedure. Over time the stored procedure has been updated to add new fields to the view. The problem is that when the new fields were added, the historical views were...more >>

Surogate keys?
Posted by Mario Splivalo at 12/20/2004 10:27:57 AM
In my application I have several store-shops. Each receipt that is printed in the store needs to have the name of the company, the address of the headquaters, the address of the shop, the phone number, and all of that. Now, I wanted to put all of that in separate table. Now, do I add, in that ...more >>

Attach db is readonly
Posted by Patrick at 12/20/2004 10:20:47 AM
Hi Freinds, SQL 2000 I detached a db abd copied files to a new server. then trying to attach there. It attached readonly. when I tryo to convert to not read only error 5105 device activation error pops ups. Please advise. Thanks in advance, Pat ...more >>

Is this join possible?
Posted by Weston Weems at 12/20/2004 10:20:12 AM
Ok, Heres a little bg info... I've got one table thats got phone number in this format: AreaCode | Prefix | Suffix -------------------------- xxx | xxx | xxxx And another table that has it in: (xxx) xxx-xxxx. Now I realize joining these two tables on the phn num isnt the ...more >>

Converting Access "SQL"
Posted by James at 12/20/2004 10:09:20 AM
Can anyone please help with converting the SQL below, I just can't get real T-SQL to handle the IF part. Thanks. SELECT tbl_Portfolio.PortfolioID, IIf([ReferenceLevel]=1,[ClientRef],[AccountNo]) AS BrokerAccRef FROM tbl_Client INNER JOIN (tbl_Broker INNER JOIN tbl_Portfolio ON tbl_Broker.Bro...more >>

SQL script generation dependencies
Posted by Maxime Plante [C.T. Consultants inc] at 12/20/2004 10:03:02 AM
Hi, I know a lot of people went throught this, but now it's my turn and I cannot find anything convinient enough for what we need. We are using installshield to deploy our application and there is a tool in there that generates the entire script to generate your db. BUT of course it does...more >>

How do I detect the SQL Server 2000 / MSDE 2000 installation
Posted by Arun at 12/20/2004 9:53:50 AM
Hi, In my installation, I need to check for the SQL Server 2000 installation and if it is not there, I need to install the MSDE 2000. Can anyone please tell me how do I detect the installations of these software in my installation program. Also, I would like to know if my database code wi...more >>

concatentation
Posted by John at 12/20/2004 9:53:06 AM
Does anyone know why this string isn't concatenating for me? I know this must be something simple that I am forgetting. declare @test char(2000) set @test='bcp "select ''$$$INS001''' set @test=@test+' queryout ' print @test...more >>

Partitioned view - updating
Posted by DWalker at 12/20/2004 9:47:49 AM
BOL states: "INSERT, UPDATE, and DELETE actions against a partitioned view are not allowed if there is a self-join with the same view or with any of the member tables in the statement." Why not? David Walker...more >>

Tablock option in bulk insert -- BOL confusing
Posted by DWalker at 12/20/2004 9:44:10 AM
For Bulk Insert and BCP, the Tablock option is described as such in Books Online for SQL 2000: "Holding a lock only for the duration of the bulk copy operation reduces lock contention on the table, significantly improving performance." Well, holding a lock only for the duration of whatever...more >>

Swapping field data randomly
Posted by John Smith at 12/20/2004 9:34:35 AM
Hi all, I have a table that contains name, address etc. I want to use the data in this table for a demo and obviously, I don't want real names and addresses to be displayed. Is there a way to swap data fields? For example, I want to swap last names and the city field, Thanks, js ...more >>

Select column names + values in query analyzer
Posted by dw at 12/20/2004 9:27:46 AM
Hello, all. We need to copy the results from Query Analyzer into Excel, but when we do, it doesn't show the column names. Excel can connect to the database, but we'd like to run the SELECT in QA, but also get the column names as the first row of the results. Thanks. ...more >>

ORDER BY and IDENTITY
Posted by Questar at 12/20/2004 9:25:06 AM
It has come to our attention that the expected (and observed) behavior of a specific T-SQL statement is not guaranteed. You have probably encountered the issue before, but I will provide two examples here. Syntax Example 1: CREATE TABLE #T1 (T1 int, Z1 varchar(20)) INSERT #T1 VALUES (1...more >>

Table row count (cardinality)
Posted by Phil Davy at 12/20/2004 8:59:06 AM
Please could someone advise me how to determine the row count of the database tables, presumably stored in the system tables? this would avoid me having to use "select count(*) from ..." I have looked in SQL Books online to no avail Thanks...more >>

SQL Express manager 2005 Connection problem
Posted by Kalyan Krishna at 12/20/2004 8:48:02 AM
Hi, My sql server instances are named as Server\Instance e.g srv1.abc.corp.com\PSE1 I'm not able to connect to such server instances using the SQL express manager 2005. However, there is no such problems in connecting to non-named (default) instances. srv.abc.corp.com Any suggestions on h...more >>

Finding out all the Nested stored procedures within a stored procedure.
Posted by Peri at 12/20/2004 8:43:29 AM
Hi All, Is there any way to find all the stored procedures call from one stored procedure. For Example, The Main sp is sp_Main. Inside this sp there are 5 sps called, named sp_Sub1, sp_Sub2, sp_Sub3, sp_Sub4, sp_Sub5 and Inside sp_Sub1 there is another function called fn_test1. Giv...more >>

Cross Tab Question
Posted by Kurt Schroeder at 12/20/2004 8:41:13 AM
Well, I'm getting better at this thank's to all your help, but i've got another question. I need a little help with constructing a Cross Tab Query. I'll start with the table: CREATE TABLE [dbo].[crt] ( [crtCsiID] [int] NULL , [crtRow] [smallint] NULL , [crtCol] [smallint] NULL , [crtChr...more >>

How to identify all tables in certain filegroup
Posted by Mike Torry at 12/20/2004 8:31:07 AM
All tables belong to Primary filegroup by default. Are there any SQL commends to list tables in a certain filegroup? Thanks in advance, ...more >>

Deadlock on a single "programming pattern"...
Posted by Hugo Venancio at 12/20/2004 8:31:02 AM
Hi, This may seams a very simple (stupid) problem, but the point is that I could'n solve it yet. So I'd appreciate your help. There it is... I'd like to test a table A for a specifi row, and if (the row) exists then it should be updated, otherwise it should be created. Something like: b...more >>

Simple Problem - Simple Solution?
Posted by DBA72 at 12/20/2004 7:49:06 AM
I want to execute a stored proc. multiple times with the least amount of code. For example, I want to execute: "sp_delete_maintenance_plan @plan_id = xxx" from the following list: "SELECT plan_id FROM msdb.dbo.sysdbmaintplans WHERE plan_id <>'00000000-0000-0000-0000-000000000000' GO" Is ...more >>

Sql order by question
Posted by Andrew Pasetti at 12/20/2004 7:45:04 AM
Is it possible to set the starting row in an order by statement? For example, Select * from Accounts order by name where name like 'B%' The result of this query, which currently is not correct, will list all the entries in the Accounts table and set the starting row at B instead of A or Z....more >>

Interesting Join Statement
Posted by scuba79 at 12/20/2004 7:39:01 AM
I have two tables that I have to join together. The first table contains what will be phone numbers and a date. The second table will contain rates that the phone number needs to be charged. Here is the first table (Phone Numbers): CREATE TABLE [PhoneCalls] ( [CallOriginatingDate] ...more >>

Day of the year
Posted by Peter Newman at 12/20/2004 7:37:04 AM
i hav a datetime field and i need to know the day of the year the date represets ie 2004-12-20 00:00:00 = 355 ...more >>

Search duplicated in a table
Posted by milly at 12/20/2004 7:29:02 AM
hi all! I have to find ou t whether a record is duplicated in a table.. I know ia have to join with the same table using an alias but i can resolve it... I have to delete the duplicated records ... any idea? thanks!...more >>

Setting Table dynamically
Posted by shop NO[at]SPAM pacifictabla.com at 12/20/2004 7:15:11 AM
Hi: I have a DTS package that first brings in data from another database into SQL Server. In the source database, the database tables are like this: TableName20041014 for example. At any one time, 10 of these tables are in the source database, every day the oldest one is deleted, i.e.: ...more >>

64bit multiple connections
Posted by Paul Durrant at 12/20/2004 7:09:04 AM
we have a dotnet webpage querying a 64bit sql table, the page will query the DB for every row produced (ed table in a table) although the statement If SqlConnection1.State = ConnectionState.Closed Then SqlConnection1.Open() End If it will always open a new connection and...more >>

Batch with cursor successful, but not really
Posted by shop NO[at]SPAM pacifictabla.com at 12/20/2004 7:04:19 AM
Hi: When working in Query Analyzer, I was working executing different code in different batches. I noticed that if I executed the same batch twice in a row, the second time it would complete immediately (and say it was successful), but it wouldn't actually do anything. The same would happen i...more >>

64bit insert delays
Posted by Paul Durrant at 12/20/2004 7:01:07 AM
we a system fed by various sources (foxpro,dotnet,ado) and we are seeing delays in the data being available, there are no insert errors, but the data does not appear for selection for at least 5 minutes ...more >>

VB & SAL Date/Time Problem?
Posted by Richard Gutery at 12/20/2004 6:31:25 AM
I've written an ASP app that requires users to login - normal stuff. As is typical with users, sometimes they just close the browser which teminates the app. What I've done is created a new table in SQL that inserts the date & time when a user logs in. All is well as other stuff. If the user...more >>

Difference between insensitive and fast-forward cursors.
Posted by SQLCatz at 12/20/2004 3:45:04 AM
Hello All, We know that both insensitive and fast-forward cursors do not reflect changes in the recordset if the base tables data changes. But, can someone please explain what the exact differences between the two are? Cheers! ...more >>

Theoretical minimum and maximum values for UNIQUEIDENTIFIERs
Posted by Geoffrey Barnes at 12/20/2004 3:39:32 AM
Does anyone know what the theoretical maximum and minimum values are for UNQIUEIDENTIFER fields. A string of '00000000-0000-0000-0000-000000000000' can be converted to a GUID value, and it seems to work as a minimum, but my attempts to use 'ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ' as a maximum valu...more >>

What's more unique as a RAND seed?
Posted by Ben Amada at 12/20/2004 2:37:33 AM
Hi, I've seen two different ways to feed SQL Server a random seed: (1) SELECT RAND( CONVERT( Int, CONVERT( VarBinary, NEWID() ) ) ) (2) From BOL: SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 ) + (DATEPART(ss, GETDATE()) * 1000 ) + DATEPART(ms, GETDATE()) ) It ...more >>

Stored Procedure enhancements
Posted by AKG at 12/20/2004 1:47:03 AM
Hi, What are the possible enhancements one can make in stored procedures. At the moment I'm using SPs to add/edit/delete and select purposes. We develop web applications. I'm a database developer. I want to create general purpose stored procedures which can be used by web developers for ...more >>


DevelopmentNow Blog