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 2005 > threads for tuesday 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

Query Question
Posted by Al Newbie at 12/20/2005 11:18:30 PM
I want to be able to select all the records from a table (query) and add a column when a certain condition exists eg Table Contents CentreA CentreB QS QSP Op JobNo WS MTN 100 10 1 G123 RT RAT 100 0 1 G45...more >>


I need to rebuild Log file from Master file
Posted by Bunthach Eng at 12/20/2005 6:48:32 PM
Dear sir, Now i have big problem with SQL i lost Log file now i have only master file . i used recovery to find Log file but not found. Please tell me how to rebuild Log file from Master file? Waiting your suport, Bunthach Eng student of Cambodia (My mail bunthachx@yahoo.com, My phone ...more >>

Registering User changing data
Posted by Roy Goldhammer at 12/20/2005 6:33:00 PM
Hello there I have many tables that i would like to kbow on each record who inserted, updated data and when it happend? For this i've learned about function call SUSER_SNAME() that always gives me the current user who is in the system. For insert case i've solved it simply: added two fie...more >>

Select/Join with Top
Posted by tshad at 12/20/2005 6:10:41 PM
I am trying to Join 2 tables to get only the last job worked at. If I have the following: DROP TABLE table1 go CREATE TABLE table1 ( Field1 int, FullName varchar(15), Location varChar(15) ) go DROP TABLE table2 go CREATE TABLE Table2 ( Field1 int, Company varChar(15), JobTitle...more >>

Change TSQl statement using case
Posted by Scotchy at 12/20/2005 6:07:01 PM
Hello all, Thanks in advance to contributions. I would like to be able to manipulate myTSQL in a stored procedure, based on a value in a parameter, using the case statement. I want to avoid Begin..End constructs My code is such... select field1,field2 etc etc from Order o inner join t...more >>

Problem : Oracle *statement* trigger runs for each row when called via a linked-server definition in SQL Server
Posted by Serdar Aytamaner at 12/20/2005 5:37:58 PM
Hi all, As I tried to describe the problem in the subject, an Oracle statement trigger (supposed to run just once) runs for each row affected by the statement which was issued from Query Analyzer or my VB.NET code, via a linked-server definition in SQL Server. This behaviour is very stra...more >>

Error automating SQL DTS Pkg from VB6 to VB.Net
Posted by John at 12/20/2005 5:26:02 PM
I am trying to convert a VB6 SQL 2000 created code into VB.NET. Everything complies fine but then I get this error message: An unhandled exception of type 'System.InvalidCastException' occurred in Project1.exe Additional information: QueryInterface for interface DTS.CustomTask failed. ...more >>

SQL 2005 books
Posted by SimonZ at 12/20/2005 4:57:45 PM
Hi, I would like to learn more about SQL 2005 and I would like to buy 2 books. First one should be the book with practical problems and solutions to that problems, so book with examples and not book about introducing the new features and full of documentation. The examples should be mostl...more >>



Reduce Log Size
Posted by Mike Labosh at 12/20/2005 3:41:58 PM
I have a database here that's 3.3 GB that has a transaction log of 14.8 GB. We want to make the log WAY smaller. like doing a checkpoint or backup with log truncation or something. Got some BOL / code snips for us? -- Peace & happy computing, Mike Labosh, MCSD "When you kill a ma...more >>

Getting the last Error Message
Posted by Alien2_51 at 12/20/2005 3:33:02 PM
I have a process that runs that pulls data from an Oracle database to SQL server, when I encounter an error I'd like to write the error description back to Oracle for the record that failed for reporting purposes. I can get the code using @@ERROR but I'd like to have the message associated wit...more >>

DDL Primer?
Posted by John Baima at 12/20/2005 3:02:59 PM
Ent Manager is nice, but I need to make some DDL changes to a database (convert a column from char to varchar, add a new column, etc) with SQL. Is there a good primer for this? I'm sure it is not too hard, I just have not had to do this. Thanks. -John...more >>

Possible Bug Using TOP and Paging via a Temp Table
Posted by psandler70 NO[at]SPAM hotmail.com at 12/20/2005 2:51:48 PM
This is not a "bug" per se, as I know that the order of rows in SQL Server isn't guaranteed to be consistent unless ORDER BY is specified. Still, this is somewhat odd behavior. This involves paging logic via parameterized queries. Since I can't post my client's DDL, I have used northwind to d...more >>

Outputting a CSV file
Posted by Willie Bodger at 12/20/2005 2:42:28 PM
OK, I've looked thru the BOL so I'm probably just using the wrong terminology, but how do I output a CSV file from a query? Willie ...more >>

Procedure or function has too many arguments specified
Posted by tjonsek NO[at]SPAM phenom-biz.com at 12/20/2005 1:39:48 PM
I am getting an error for code structure I have used several times before with no hitch. "Procedure or function xxx has too many arguments specified" Here is the code I am executing. sql.CommandText = "sp01_InsertEmployee" sql.Parameters.Add("@emp_name", SqlDbType.VarChar, 50).V...more >>

Sql view
Posted by bob at zachys at 12/20/2005 1:31:03 PM
Is it possible to do a if then else statement in a sql view qry. I am use to Ms Access and using Immediate If (IIF). What Im trying to do is If Left (FieldA,1)=3 Then "xyz' else If Left (FieldA,1)=4 Then "abc' else If Left (FieldA,1)=5 Then '123' ...more >>

Changing a column to an Identity column. Please Help...
Posted by RSH at 12/20/2005 1:25:55 PM
I have a situation where we converted over a large database. The database had one table that used autonumber(Access) that we need to preserve the IDs upon conversion for a table that refereneces the field. So during conversion I turned off the identity and it brought over the ID column wit...more >>

Run jobs in SELECT CASE?
Posted by Test Test at 12/20/2005 1:03:58 PM
Hello! Is that possible to call a job using SELECT CASE statement? I am trying to run some jobs based on some cases in my stored procedure. See below the code: select case RptName when 'A' then [msdb].[dbo].[sp_start_job] @job_name = 'A' when 'B' then [msdb].[dbo].[sp_start_job] @job_n...more >>

String Function for Grouping
Posted by Islamegy® at 12/20/2005 12:38:00 PM
Hello I have 2 tables Table1> Table2 (1-* relation) Table1 (ID,Name) Table2 (ID,Table1ID,ImagePath); I need to select from Table2 group by Table1ID and concatenate ImagePath(s) with "," separator. How could i do this?? ...more >>

Replace substring
Posted by maxbrit at 12/20/2005 12:07:28 PM
Hello Need to replace text_A with text_B contained within 2 columns of table., SQL server 2000. table name = stock column names = description and long_description Thanks for any help Regards Maxwell ...more >>

sql server 2005 Ebook
Posted by Maryam Arshi via SQLMonster.com at 12/20/2005 11:55:58 AM
Hi, do u know a good Ebook for sql server 2005? -- Message posted via http://www.sqlmonster.com...more >>

Adding a Column in an Ordinal Position
Posted by RSH at 12/20/2005 11:55:03 AM
I have a situation where I am using SQL Server 2005 and I need to be able to add a column in a specific ordinal position. I have looked at BOL and I wasn't able to find any mention of being able to specify Ordinal position. Is there a way??? Thanks! Ron ...more >>

clear sql error
Posted by Vikram at 12/20/2005 11:45:11 AM
i am using sql 2000 and calling a sp from vb.net code. I want when a error occur in sp i want to do some processing in sp and do not want to throw that error to front end. how can i achieve that as after checking @@error and doing processing, still error gets thrown to front end ...more >>

indexes.
Posted by Jason at 12/20/2005 11:42:19 AM
Hi. I have 2 queries that are similiar They involve 2 tables, 1) CDR which has a primary key of cdrid and has half a million rows 2) MODULE which has a primary key of moduleid and has only 240000 rows Neither of the two tables have indexes in it aside from the clustered index produced...more >>

How do I use SELECT on a column with datatype TEXT?
Posted by gene.ellis NO[at]SPAM gmail.com at 12/20/2005 11:33:49 AM
Hello. I using a simply SELECT statement to retrieve some data from a SQL SERVER via an ODBC connection. I had to go from VARCHAR to TEXT because the amount of data. Anyway, my SQL statements worked just fine when I was using VARCHAR, but now since I am using TEXT, I am only receiving part of th...more >>

Last table date access
Posted by Huacuz at 12/20/2005 10:36:04 AM
I need to know the last time each table on my database was accessed or modified. Is that possible? I'm usign SQL Server 2000....more >>

Coalesce and CASE
Posted by BobS at 12/20/2005 9:45:02 AM
I'd like to expand a coalesce function to account for Case 3, which says that if Date2 is null, then stay with null. As you see the following only satisfies Case 1 and Case 2. Any ideas appreciated. I think that a fancy CASE statement might do it, but I can't figure it out. Thanks, --Bob Sel...more >>

SQL Union issue, detail records returned when condition not satisf
Posted by Erik at 12/20/2005 9:07:02 AM
Good Morning, I have the SQL statement below which displays each detail record from a table, using a union for the column total row. My issue is when I try to return records where the sum of service is greater to or less than a value, all detail records are returned. For example, the ye...more >>

Convert Informix to SQL Server
Posted by Apaxe2000 at 12/20/2005 8:42:17 AM
Hello, i need to convert this store procedure from Informix to SQL Server and only obtain error's. Can anyone help me? CREATE PROCEDURE atribui_num_carta @dia_env INT, @mes_env INT, @ano_env INT DECLARE @aux_numcarta INT, @aux_nu...more >>

OT: Need Project Tracking software
Posted by Antonio at 12/20/2005 7:57:03 AM
Hi, sorry for the OT question but the readers opinions will matter more to me. I team lead a small development team of .net and sql programmers. There is another team in our group like ours. We are tracking our project requests and statuses in Excel as it is shared with people ourside our te...more >>

Performance question.
Posted by mvp at 12/20/2005 7:32:02 AM
Hello Everybody, I have a table which has arround 30 millions rows. Table structure is as following.. CREATE TABLE TestTable (Id INT, --which is PK, EmpId INT, --There is a non cluster index on it. DeptName VARCHAR(50), Hours NUMERIC(5,2), Tdate DATETIME, ProjectNumber smallint, ..and fe...more >>

Custom Error Message for Check Constraints
Posted by John Smith at 12/20/2005 7:27:23 AM
Is it possible to make Sql Server throw a custom error message when a CHECK Constraint fails please? ...more >>

global temp table issue with SQL Server 2000
Posted by Ken Abe at 12/20/2005 7:03:03 AM
In a SP I create a global temp table as follows: if not object_id('tempdb..##t') is null drop table ##t create table ##t (a int, b int) Then, only on occasion, I get an "invalid column" error when referring to column b. I think this is due to the fact that I create a table with the same ...more >>

Easy Start
Posted by STIPPYz at 12/20/2005 4:48:02 AM
Hello All, I am trying to get started with SQL programming and don't know where to begin. I would like to use Visual Studio.Net and access a "local database". For example, something simple like a "member database" for a volunteer organization. My first concern is how and what to inst...more >>

sysindexes
Posted by marcmc at 12/20/2005 4:40:02 AM
hey all, I have a main program ('Program1) which calls ('Program2') Program2 creates indices on a staging table to spped up Program1. At the end of Program1, I call program2 to drop the indices. I have noticed that this time when Program2 is called I cannot create the indices as it is atte...more >>

user function basic question
Posted by rmanchu NO[at]SPAM gmail.com at 12/20/2005 3:58:00 AM
sample function from web; CREATE FUNCTION dbo.DBCreationDate ( @dbname sysname ) RETURNS datetime AS BEGIN DECLARE @crdate datetime SELECT @crdate = crdate FROM master.dbo.sysdatabases WHERE name = @dbname RETURN ( @crdate ) END GO what if the SELECT returns more than o...more >>

Getting Job name, Job ID , Step within the Job
Posted by Shinu at 12/20/2005 2:47:01 AM
Hi There, Can I get the Job ID , Job name and Step ID withing the job itself ? Infact my need is to send a mail with these parameters and some data from user tables. This process I have to do from the different servers and jobs. I would like to impliment this without hardcoding the job nam...more >>

Stored procedure using dynamic WHERE statement
Posted by dan_williams NO[at]SPAM newcross-nursing.com at 12/20/2005 2:32:46 AM
Does anyone know how I can do something like the following:- CREATE PROCEDURE GetClients @deptId as int, @clientGroup as int AS BEGIN SELECT ClientId, Business_Name FROM Clients INNER JOIN ClientStatus ON Clients.CSId = ClientStatus.CSId INNER JOIN Depts ON Clients.DeptId = Depts.DeptI...more >>


DevelopmentNow Blog