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 > november 2006 > threads for thursday november 16

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

Using multiple columns in IN clause
Posted by Prasanna at 11/16/2006 10:51:02 PM
Hi, I am new to SQLServer and I need a calrification on the following: I am trying to get 2 column data from a table Table1 which does not exist in Table 2 (ie) the combination of (col1,col2) should not be in table2. The query I tried is as below: Select col1, col2 from T...more >>


query
Posted by vanitha at 11/16/2006 10:43:02 PM
hi, i have a table like orderid int trackid int trackevent varchar(50) values will be like orderid trackid trackevent 1 1 'sample' 1 2 'process' 1 ...more >>

UNION Select Count(*) from 3 tables with where clause on each
Posted by hals_left at 11/16/2006 10:13:40 PM
Hi waht is the syntax for the above, this only return 1 row instead of 3. Thanks. Each table has dteExported column. Thanks. select count(*) from tblA WHERE DateDiff(d,dteExported,GetDate())>1) UNION select count(*) from tblB WHERE DateDiff(d,dteExported,GetDate())>1) UNION select count(*) ...more >>

primary column
Posted by vanitha at 11/16/2006 7:49:01 PM
hi, i want to retrieve the table which is having that column as primary in a particular db. example. i want to retrieve in which table emp_id is primary key. please help me to solve this. thank you vanitha...more >>

SQL Server 2005: Intercepting and Managing Queries
Posted by grp.anon NO[at]SPAM gmail.com at 11/16/2006 7:32:26 PM
Hello Everybody, Is it possible to intercept queries on the SQL Server prior to processing and encompass some rules around how the queries are processed? For e.g. Depending on variables I may want to deny users querying capabilities or forward them to another instance or modify queries bas...more >>

Finding a string within a string
Posted by Mike DeYoung at 11/16/2006 6:55:01 PM
Hello All, New to group... thanks for any help. I’m trying to find a string within a string… I have an IP telephony phone system database and a customer database. On a monthly basis I want to match up customer calls and report. The telephone database.table.phonenum field data is co...more >>

sql asp / db owner problem? HELP
Posted by agesone NO[at]SPAM gmail.com at 11/16/2006 6:53:31 PM
Hi, I had 1 database in sql, i have made a new database and then used the import/export tool. I have the 2nd db made now with tables copied from the 1st database. So when i make the conn to the 2nd dbase through adobc and asp, after i have added the column 'ACTIVE' to the new database (2nd) a...more >>

How to return recordsets larger than 4 bytes.
Posted by Pop at 11/16/2006 6:33:02 PM
Hi, I'm having this problem, please refer to the link below. http://support.microsoft.com/default.aspx/kb/248668 It suggest to work around this problem, return recordsets larger than 4 bytes. The problem is, I don't know how to return recordsets larger than 4 bytes. So, how can I do thi...more >>



i have two inserts and one delete i want in one transaction, is there any issue with this tsql strategy: http://rafb.net/paste/results/uY2KYP16.html
Posted by Daniel at 11/16/2006 5:34:45 PM
i have two inserts and one delete i want in one transaction, is there any issue with this tsql strategy: http://rafb.net/paste/results/uY2KYP16.html ...more >>

multiple case requirements
Posted by ana9 via SQLMonster.com at 11/16/2006 5:26:44 PM
I need to create a statement like the following: CASE WHEN work_type='Travel' OR work_type='Travel - After Hours' OR work_type='Travel 24X7' THEN Billable_Hrs END AS 'Billable Travel' If I do each CASE separate SQL creates BillableTravel, BillableTravel1, BillableTravel2, creating NULL value...more >>

Basic questions on locking and avoiding deadlocks
Posted by Christian Schaeffler at 11/16/2006 4:31:22 PM
Hello newsgroup! We are using SQL Server as database for an application. Recently we faced some deadlock errors and now I'm trying to understand what happens... I already did the basic tracing with SQL Profiler and the DBCC TRACEON (3605,1205,-1) parameters and isolated some deadlocks with t...more >>

Get FileNames
Posted by WCM at 11/16/2006 4:16:01 PM
RE: Sql Server 2000 I have written a proecedure that gets a .bak file from an ftp site and then restores the .bak file to a db on our local server. The procedure sets the db to single user, then uses xp_cmdshell to read/execute ftp commands from a text file, does the restore from the .bak f...more >>

What are the advantages of clustered Index
Posted by Rob Miller at 11/16/2006 3:13:47 PM
When we do select * from table it always return rows sorted by the column which has clustered Index. What are the other advantages of having clustered Index. Does it increase performance. Do we need to have one or not. Please advise. Thanks, Rob ...more >>

order of evaluation of expressions in select list
Posted by Stephen Ahn at 11/16/2006 3:13:06 PM
Using SQL Server 2000, Given data like this : == create table testorder (id int primary key, price decimal(18,4), quantity int) insert testorder values (1, 100, 4) == I then run the following : == declare @priceWithTax decimal(18, 4) declare @totalValue decimal(18, 4) select @price...more >>

How many users are using the DB
Posted by Roy Goldhammer at 11/16/2006 2:10:59 PM
Hello there I have some things i must run when no user are using it Is tehre a way to know how many users are using the database? ...more >>

About string index
Posted by Iter at 11/16/2006 2:10:01 PM
Is there a string function that allows you to find the first index of a character from right side? CHARINDEX is okay to search beginning from left side , but if I want to search it beginning from right side, how to do? Thanks. ...more >>

UPDATE trigger help
Posted by David at 11/16/2006 2:08:44 PM
I am trying to create the trigger below, but I am getting an error in reference to the "inserted" table. Can anyone help me fix this? Thank you. David CREATE TRIGGER [dbo].[T_RepairOrder_UTrig] ON [dbo].[RepairOrder] FOR UPDATE AS IF UPDATE(InsuranceAdjuster) BEGIN UPDAT...more >>

out of sync
Posted by CLM at 11/16/2006 1:59:01 PM
I'm looking for the best way to monitor any failures in my log shipping (in 2000) via email. Here are a few ideas: 1. Look for the words "out of sync" in the sql server log. Will this be reliable? I don't really want to use job notification via email because it will happen every five...more >>

Logged in username
Posted by David at 11/16/2006 1:36:22 PM
Is there any way to get the network username in TSQL using SQL 2000? I looked in the @@ variables but didn't find anything. Thanks. David ...more >>

Indexes on large tables, multicolumn or singlecolumn.
Posted by Kay-Christian Wessel at 11/16/2006 1:33:03 PM
We have an 8 million row table with 2 indexed columns. The indexes are created as singe column indexes. Some query's with a WHERE clause like 'col1=4443 AND col2=7733' takes a lot of time Now it looks like this : Index 1 : col1 Index 2 : col2 If I change this to : Index 1 : col1,...more >>

killing process
Posted by Roy Goldhammer at 11/16/2006 1:32:17 PM
Hello there I have process of droping clustered index who takes too long if i will fill the process will it can cause damage to the database? ...more >>

Log Shipping
Posted by CLM at 11/16/2006 1:14:02 PM
I've got log shipping running on four db's from one 2000 server to another. 3 of the 4 db's are doing just great but the fourth is now failing. When I go to the log monitor, I notice that the backup history is showing nothing but success. And when I look in the copy/restore history, then co...more >>

Migrate update statement to Oracle
Posted by Stefan Olofsson at 11/16/2006 1:06:59 PM
Hi all I have the update statement written for SQLServer 2000 below and need to convert it to Oracle 9. It seems like Oracle does not support joins in update queries :( How can I do this in Oracle 9? (And yes, I know this is a MS SQLServer group...) Thanks in advance Stefan update ...more >>

adding another row in the select? join? nested select
Posted by jobs at 11/16/2006 1:05:07 PM
working in asp.net 2.0. I have a dropdownlist with a sqldatasource selectcommand. Currently just doing a select distinct * from table order by code (the second field). I'm trying to stay only in the markup, and I'd like to add a temporary (for the sake of the control only) entry to the drop...more >>

SQL query needed
Posted by saurabh at 11/16/2006 1:01:22 PM
Hi i need pointers to some place where i can find advanced sql querries....i am sittting for an interview and would like to have my hands on sql queries Regards, Saurabh ...more >>

SQL Query Question
Posted by Hotmail at 11/16/2006 1:01:02 PM
I am a bit of a newbie to SQL Queries and need some help with the following query. I have two tables in SQL 2000 which hold info about user and roles. In the first table I have a set of user info containing the following columns. The user name is the primary key in this table. user name,...more >>

context_info for debugging?
Posted by B D Jensen at 11/16/2006 12:52:34 PM
Hi! I want to use an session-variable that holds information if to debug should be activated or not. How to do this? ....spMyProc as select * from tblA if globvar = 1 print 'hello' select * from tblB GO ======================== set globvar=1 exec spMyProc /Thanks for help Bjorn ...more >>

null or not null
Posted by iam4msu at 11/16/2006 12:49:02 PM
got a column named testcol in table mytab defined as a varchar(50) and not null. it looks like there are records with null values for testcol (1) select count(*) from mytab where testcol is not null (returns all records) (2) select count(*) from mytab where testcol is null (returns 0 r...more >>

Viewing Index Columns and their Types - Auto. Fragment Index Rebui
Posted by Adam St. Pierre at 11/16/2006 12:35:01 PM
Hello everyone! I'm writting a stored procedure that automatically rebuilds indexes once their fragmentation drops below 50%. It esentially cycles through the indexes, grabs the names of the index and the table and then performs the command: Alter Index [Index Name] on [Table Name] REB...more >>

Pass Variables to BEGIN or END T-SQL query
Posted by bt7403 at 11/16/2006 12:31:01 PM
I have to run a SQL job based on ----------------------------------------------- USE Process GO Update TA set sap_no=TL.sap_no,product_order=TL-product_order from teosauto AS TA join teoslot AS TL on TA.product_order=TL.product_order --The above query works. However, if no records f...more >>

Get a list of stored procs running
Posted by Jim at 11/16/2006 12:04:02 PM
Is there a way to generate a list of currently running store procedures? -- Thanks, Jim...more >>

order stored procedure by when it was modified
Posted by JJ at 11/16/2006 11:59:28 AM
RE: SQL Server 2000 I am looking for a script that lists user stored procedure based on modified date. Modification could have been done through SQL or Enterprise manager. Is there a way to accomplish this? Thanks ...more >>

use "left join" or "not exists" ?
Posted by Stephen Ahn at 11/16/2006 11:59:23 AM
Using SQL Server 2000, Example : == create table jtest1 (id int primary key, col1 varchar(10)) create table jtest2 (id2 int primary key, col2 varchar(10)) insert jtest1 values (1, 'hello') insert jtest1 values (2, 'two') insert jtest2 values (1, 'world') == Now, I think the follow...more >>

Float Precision
Posted by Manny Chohan at 11/16/2006 11:52:02 AM
In enterprise manager, i want to control the number of characters after the decimal. I need to have only 2 digits after the decimal. How can i set the precision in enterprise manager? Please let em knwo know if it can be done alternatively or throught enterprise manager? i am using SQL 2000...more >>

half a transaction inserted!!!
Posted by xamman at 11/16/2006 11:51:49 AM
if i am defining the two inserts as one unit why does it carry on with the insert into c!!! what is the point of using transactions on SQL if you have to check the @@error anyways! or am i misunderstanding something here. create table c (c int) create table d (d int not null) begin tran...more >>

Problem with aggregates
Posted by Jason Wilson at 11/16/2006 11:40:57 AM
Background: I would like to create a view or stored procdure that would that take a datetime column and group them by the difference from the current time and reports the resultsin columns like this: name 12hrs 24hrs 48 hours 72hrs 192hrs 193+hours Is there a way to grou...more >>

INSERT INTO #temp EXEC (@SQLCMD)
Posted by Matthew at 11/16/2006 11:29:41 AM
Anyone know why this is not working. It works for some other things I am doing? Thanks -Matt- DECLARE @unqName NVARCHAR(100) DECLARE @SQLCMD NVARCHAR(MAX) SET @unqName = 'SomeSystem' SET @SQLCMD = 'SELECT name FROM [' + @unqName + '].somedatabase.dbo.sysobjects WHERE name = ''sometable''...more >>

Inline Comparison in Select?
Posted by robbie NO[at]SPAM fordpinto.com at 11/16/2006 11:12:37 AM
Hello All, I'm trying to figure out how to do an "inline if" in a select query. It's a construct that's been around for a long time, nothing new or esoteric. The IIF function that exists somewhere in SQL Server (Analysis Services I think) is not recognized in Select queries. (I've been doing ...more >>

Stored Procedure(s) vs Dynamic Stored Procedure
Posted by Rob Meade at 11/16/2006 10:21:34 AM
Hi all, Ok - I have a scenario where I'm trying to build up a sql statement to execute in a stored procedure, depending on the 3 parameters passed in (ie, whether they are <> '') depends on which one of the IF blocks gets run, and subsequently, which bit of WHERE criteria is added to the bu...more >>

Secutiry Basics
Posted by si at 11/16/2006 10:17:24 AM
Hi, I am very new to SQL Server (coming from an Access SQL programming background). I am looking for advice and beginners literature on SQL Server security. I am presently continuing the development of a VB6 application that operates on a SQL Server database. As I understand it, all users ...more >>

Best way to represent category, subcategory, product
Posted by TH at 11/16/2006 9:59:19 AM
What would be the right pattern (is pattern the right word?) to model the following scenario in a relational database? A category has many subcategories, a subcategory has one category. So: Cat:(CatID, CatName) Subcat:(SubcatID, SubcatName, CatID) So far so good. Now a product is either i...more >>

Bizarre error from SSIS package
Posted by zdrakec at 11/16/2006 9:58:30 AM
Hello all: I have a package with a precedence constraint containing the expression: ISNULL(@endDate) == True (I have tried other variations, of course, since ISNULL(@endDate) is functionally equivalent). I have another precedence constraint of value: ISNULL(@endDate) == False Here ...more >>

SSIS script that will populate a global variable into a record
Posted by kentrubin NO[at]SPAM gmail.com at 11/16/2006 9:35:49 AM
Basically, something like System::Username into a record. Something like: Dim strConnection As String strConnection = "Data Source=testbox;Initial Catalog=testdb;Integrated Security=True" Dim connection As New SqlConnection(strConnection) connection.Open() ...more >>

DateTime Field
Posted by bmuldoon76 at 11/16/2006 9:32:02 AM
Why does a datetime field only get populated with a date stamp and in other instances be populated with a datetime stamp. This particular datetime field default is (getdate()) when a record is inserted Is it due to Regional Settings were SQL server is installed or determined by the Clien...more >>

Compare tables - insert new rows
Posted by Elmo Watson at 11/16/2006 9:27:24 AM
I've got two tables - one is the master list, which has new stores in it, with the field names a little different, and in a different order - I've got to merge only the new items in the master list (based on store number) into the other table - I was told to do a left outer join, and insert only...more >>

import data from text file to sql server 2005
Posted by gordon at 11/16/2006 9:20:21 AM
Hi I am farily new to sql server 2005 and I have been asked to import some text files to sql server. Since I haven't done this before I thought I would use the opportunity to learn more about sql server 2005 at the same time. I normally like to start off with something simple and I have c...more >>

cmdshell copy file to network drive
Posted by Developer at 11/16/2006 9:12:51 AM
Hi, I want copy xls file to Network drive. EXEC MASTER..xp_Cmdshell 'copy "c:\connect\einvoice.xls" "\\Server\C$\test\"' I generated following message Logon failure: unknown user name or bad password. Where should i specify user name and passowrd? I can map drive but it also not worked. Any ...more >>

Backup newly created DB
Posted by kwarr15 at 11/16/2006 9:12:02 AM
Hello all, I have an app that creates a new database everyday w/ its name in the format DB_YYYYMMDD. How could I script a backup only for newly created db's?...more >>

Select rows by most recent date
Posted by Spiderhawk at 11/16/2006 9:01:09 AM
Here we go: I have a table that has an item quantity and a date created field. There are going to be multiple entries for the quantity. Each night a file will be imported that adds a new row with the updated quantity for that item. ( I don't have any control over this system of importing ) ...more >>

Alter column in a database that is a transactional replication publisher
Posted by Chedva at 11/16/2006 8:52:02 AM
When I need to add columns to my publisher in a transactional replication I use the sp_repladdcolumn. How do I Alter a column with no need to stop and recreate the replication??? ...more >>

dos commands
Posted by Aikiart at 11/16/2006 8:34:01 AM
Hello everyone, I'm running a simple database backup, using Sql 2005 express. The database backup works fine, but each time I run it, rather than writing over the existing backup file, it's appending to the file. I'd like to have it overwrite the existing file each time. I was thinking ...more >>

make a SP to copy txt file in to a text field
Posted by Per W. at 11/16/2006 8:25:46 AM
Hi, i need some helt to make a stored procedure to copy a file in to a text field. I have the unc path and filename to the file and thats what i want to use in the SP /Per W. ...more >>

copy on row to another table
Posted by Per W. at 11/16/2006 8:23:57 AM
Hi, how can i copy one row of data from one table to another table on diffrent databases on the same sql server? the table has the same structur on both databases. /Per W. ...more >>

Writing to the transaction log
Posted by Scott McNair at 11/16/2006 7:52:30 AM
Is there a way to add entries to the transaction log programmatically? I'd like to log the results of an hourly process, so that we can go back and review at any given time. Google is no help to me on this. Thanks in advance for any help....more >>

Learning SQL
Posted by Alan at 11/16/2006 7:43:01 AM
I am a freelance IT guy and have a number of small clients in my home town. One of theses clients is about to install an SQL based application which wil need some development work. They asked me if I could do it but knowing Squat about SQL I suggested they find someone who knows SQL very well ...more >>

Automating KILLs
Posted by Scott McNair at 11/16/2006 6:56:40 AM
We have a VB app that a contractor wrote quite some time ago, and apparently there's some weaknesses in the code regarding connections to the SQL box; her processes don't die in a timely manner. I'm suspecting that she didn't properly deallocate a cursor or something, but that's neither her...more >>

inner join issue
Posted by samuelberthelot NO[at]SPAM googlemail.com at 11/16/2006 6:26:37 AM
Hi, Here are my tables: [PubToDelete] {PubToDeleteID, Pub1ID, Pub2ID} [Publication] {PublicationID, Title} I want to do a join on those two table on the PublicationID to get the title. The issue is to do it for Pub1ID and Pub2ID at the same time... Can you help ? ...more >>

How to access a text file in SQL Server 2005 (dinamicaly)
Posted by dcristu at 11/16/2006 4:59:01 AM
Hi I need to access text files dinamicaly. Here is the solution I used in SQL Server 2000...(unfortunately it didn't work in SQL Server 2005) Create a linked server using MSDASQL provieder, add login: EXEC sp_addlinkedserver 'TEXTSRV', 'Any', 'MSDASQL', NULL, NULL, 'DRIVER={Micr...more >>

Related records as a list
Posted by Grant Ord at 11/16/2006 4:54:01 AM
Is it posible to return related records as a list rather than separate rows? e.g. from a query like: SELECT Name, Favorite FROM Names INNER JOIN Favorites ON Names.NameID = Favorites.FavoriteID You get a result set like: Name Favorite John Red John Orange ...more >>

tSQL float data type stores fewer digits than float column data type
Posted by roel.schreurs NO[at]SPAM gmail.com at 11/16/2006 4:31:50 AM
Hi all, I encounter suprising behaviour with variables declared with the floating point data type in Transact SQL. Even if I explicitely declare my tSQL variable of the same precision as a field in a table, it will loose many of its digits. Is there a way to declare a float variable that will...more >>

Table Design
Posted by RON at 11/16/2006 2:49:34 AM
I would like to design a SQL Server 2005 DB table named 'Orders' for a shopping cart app which will store the order details like ID, OrderKey, ProductID, Quantity & OrderDate. The ID column would be an Identity column. A DB table named 'Products' with the columns ProductID, [Name], Description &...more >>

Sql quey for move one table contents into another
Posted by Sirisha at 11/16/2006 2:04:46 AM
I want a query for selected rows in one table move to another table ,so selected rows in first table can be dissaper. example :table Name- tabletemp AutoId(primary Key) Name 1 Sirisha 2 Chaya ...more >>

help needed
Posted by nil at 11/16/2006 1:07:21 AM
hello everyone..my self nilesh and i m new to vb.net and developing one web application..and now i've one problem...the problem is like that i m creating one datatable and in that user will add new record by making dataentry and that record is stored and when make dataentry second time the first...more >>


DevelopmentNow Blog