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
August 2008
all groups > sql server programming > january 2006 > threads for friday january 27

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

Send bulk data to SQL
Posted by Sirisha at 1/27/2006 10:30:27 PM
hi, I have to send bulk data to the SQL server. I have an arraylist of the test object and for each test i am making a SQL connection. It is slowing down the process very much. Is there another way to do that. I have a transaction and for each test i can update, insert or delete depeding...more >>


Script out whole SQL SERVER Database including INSERT
Posted by chirantan.chakraborty NO[at]SPAM gmail.com at 1/27/2006 9:36:44 PM
Hi All, I am trying to script out a whole SQL SERVER database with all objects in it along with INSERT Statments to populate data into the table. My goal is to have one single file which I can just run and produce the same structure in a new system. I do not know if there is a way to do th...more >>

Query Help
Posted by David Tilman at 1/27/2006 5:25:15 PM
I have a database table with data like this (some fields ommited): reserveID owner creator ----------- ------- -------- 39009 1 0 39009 0 1 39100 0 1 I would like to do a query that would return all rows in which a reser...more >>

How to group on half-hour increments on a datetime field?
Posted by Edgard L. Riba at 1/27/2006 4:55:40 PM
Hi, In my table I have a datetime field (called modtime), and I need to build a select statement that groups by half-hour increments, so that it looks something like: modtime SUM(sales) 7:00 - 7:30 9999.99 7:30 - 8:00 9999.99 8:00 - 8:30 9999.99 et...more >>

Select statement without specifying Field or table name
Posted by Justin Doh at 1/27/2006 3:45:28 PM
I am trying to find any record in a table or database where record is empty without specifying column/field name or even table name. What would be the query statement? For example something like; SELECT * FROM table1 WHERE ???? = '' SELECT * FROM database1 WHERE ???? = '' What I...more >>

Notify Apps When DB is Updated
Posted by Jeff at 1/27/2006 3:09:53 PM
Just wondering what techniques are generally available or employed when different client application instances must be notified when data changes in a database. For example, assume a basic client/server Windows Forms application that uses SQL Server (2000 or 2005) on the back end. Client1 up...more >>

Reseed identity column in SQL 2000
Posted by ktrock at 1/27/2006 1:37:27 PM
Hello. I see that we're not permitted to reseed a incremental column to a value that's lower than the highest value in the table. I guess that's in there for our protection but is there any way around this? On an integer column I manually set row to a value of 2 billion and had planned to rese...more >>

Materialized Views
Posted by MAS at 1/27/2006 1:34:26 PM
I'm having a problem creating a materialized view. Here's the view definition: Create View audit_Report WITH SCHEMABINDING AS select a.audit_id, a.status_id, a.audit_date, a.reference_name... from dbo.audits a join dbo.references r on a.reference_id=r.reference_id The view is created ...more >>



SQL Express
Posted by jhcorey NO[at]SPAM yahoo.com at 1/27/2006 1:18:26 PM
We have a commercial VB6 app that uses Access. We want to start using SQLServer, and I see that Express is 'a free, redistributable version of SQL Server 2005' (quote from MS) that we could use as an imbedded database. However, if we change the app, we will have to provide a conversion path ...more >>

Slecting from an ordered list Query. Pls help.
Posted by MittyKom at 1/27/2006 12:56:27 PM
Hi All I need some help. I have a table. It has 2 columns, ColA and ColDate. e.g ColA ColDate 1 01/1//05 1 02/12/05 2 01/23/05 2 03/2/06 3 014/01/05 I want to write a query that gives me the most recent ColA with its date. I can have duplicate...more >>

Return value in SQL
Posted by Dgod at 1/27/2006 12:27:09 PM
INSERT INTO table1 ....... (I added a record into a table). I have an identity field (RecID). I am now recording add transactions in a database. I want to capture the RecID I just added into another table INSERT TO table2 (NewRecID) VALUES ( (S...more >>

Conditional Where
Posted by Brian at 1/27/2006 12:12:53 PM
I have a stored proc that accepts several parameter, one being relocation_id. If it is passed in I want to add it to the Where clase AND rd.relocateID = @relocation_id Ive been trying to avoid dynamic sql and thought I could do something with COALESCE but I cant seem to get same results f...more >>

Stored Procedure to Make One Table Match Another
Posted by Tom Cole at 1/27/2006 11:45:30 AM
I have two tables with identical structures (for example): items_1 id int identity item_no nvarchar 11 description nvarchar 255 items_2 id int identity item_no nvarchar 11 description nvarchar 255 Users can add, delete and change data in items_1 at wi...more >>

where datefld =... vs datefld Between ... not getting same recor
Posted by Rich at 1/27/2006 11:43:38 AM
Hello If I use Where datefld = '1/24/06' my query returns 1 record containing that date. But if I use datefld Between '1/24/06' and '1/27/06' it returns 6 records of which 3 are from '1/24/06'. Why do I not get the 3 records when datefld = '1/24/06'? Here are my queries are resultsets...more >>

Date problem
Posted by Willie Bodger at 1/27/2006 11:21:33 AM
I want to be able to set-up a job that runs every month on, let's say, the 15th. Now, that job will always look to the following month and pull every transaction of a certain type that falls within that month. So, given that the table I ma pulling from has dates attached to each record, is the...more >>

Table Scan Cost: 0%
Posted by culam at 1/27/2006 10:50:26 AM
I am trying to fine tune some of my Queries and I noticed some TableScan with cost: 0%. Should I worry about these TableScan? Thanks, Culam...more >>

Syntax Error in Update
Posted by YAHOOid at 1/27/2006 9:29:26 AM
Can't figure out why I am getting a syntax error on this Incorrect syntax near '@RecordID' RecordID is an integer UPDATE CCI SET Insured = @Insured, State = @State, CCICode = @CCICode, Occupation = @Occupation, PolicyNumber = @PolicyNumber, PolicyEffective = @newPolicyEffective, P...more >>

finding max date
Posted by Confused at 1/27/2006 9:03:41 AM
I am not sure how to phrase this query...if i could have MAX in my where clause it would be: SELECT jj.id, jj.lastname, jj.firstname, jj.StartDt, jj.TotalDays, sum(jpm.NbrDaysPaidFor) AS DaysPaidFor, sum(jpm.Amount) AS TotalPaid FROM table1 jj inner join table2 jp on jj.id = jp.id inner ...more >>

Adding Serial No in the Query Resultset
Posted by Ghulam Farid at 1/27/2006 8:59:56 AM
Hi to All! Can any one help me in generating serial no in the query result? e.g. i write a query it gives me 500 rows. select name,fathername from abc name FatherName Harry David Sarah Nenry .. .. .. .. i want that reslut should come like that S-no ...more >>

move row data
Posted by Dgragg at 1/27/2006 8:59:02 AM
I have a row that contains invalid information. I have created another row with the correct data. each row has a sequence number on it. The other two fields in each row contain binary data. how can I move the binary data from one row into the incorrect row and maintain the sequence number ...more >>

Running total using day before record.
Posted by AshleyT at 1/27/2006 8:58:04 AM
I have 1 record per day with a Daily Difference. I would like to also keep a running difference. So I am looking for a way to insert the value for RunningDiff RunningDiff = PreviousDay's RunningDiff - current day's DailyDiff date, $ShouldHave, $Have, DailyDiff, RunningDiff 1/23/2006, 12...more >>

Find a certain table in multiple databases
Posted by Bob at 1/27/2006 8:53:26 AM
Hello folks. I have a list of servers and for each server I need to loop through all the databases on that server and see if there is a table with the name XYZ (for example). I guess I would start out by going to the master database on the server. Which table do I need to open to find ...more >>

Help with a loop to collect database names and tables within those databases.
Posted by Matthew at 1/27/2006 8:49:31 AM
I am trying to create a loop that will go though all the databases and collect all the table names. Currently the loop goes around and around till it scans all the databases but only pull from the current database you are in. I am probably missing something that is obvious. DECLARE @ExecSQLcm...more >>

calculate base 32 notation from int value?
Posted by jason at 1/27/2006 8:23:31 AM
hello everyone, i have an artificial keying system that is based upon a psuedo-randomly changing 31 bit pattern stored in the database as an int. the current key is stored in a table like so: create table artificialkeys ( keyname varchar(50) primary key not null, keyvalue int) go i...more >>

Joining to large tables to perfrom update
Posted by Andy at 1/27/2006 8:07:03 AM
I have 2 large tables that are over 11 million records each. I need to join them on 1 field and then update 4 fields. So my script is this update a set a.field1= b.field1, a.field2= b.field2, a.field3 = b.field3, a.field4 = bfield4 from a inner join b on a.field5= b.field5 This...more >>

varchar overflow into an int column
Posted by I NO[at]SPAM n at 1/27/2006 7:27:04 AM
alter PROCEDURE upGetWarehouseItems @warehouse_name varchar(50), @criteria_name varchar(50), @status_name varchar(50), @customer_id varchar(50), @warehouse_rpt varchar(20), @track_num varchar(50), @weight varchar(50), @description ...more >>

Service Broker - Queue Priority
Posted by bvbone69 NO[at]SPAM yahoo.com at 1/27/2006 6:57:02 AM
Is there a way in Service broker to change the priority of a conversation (or group) within a queue? thanks bv ...more >>

SMO - Scripting Indexes (Clustered and Non-Clustered) w/o Primary
Posted by JasonDWilson at 1/27/2006 6:41:01 AM
I am writing an SMO console application (in C#) to script out a database. I am spitting out a seperate file for each type of object. First and foremost, I am NOT a C# Programmer, secondly, I cannot figure out how to script out indexes without it including the primary keys. Below is a code s...more >>

Alter table and size changes
Posted by Darin at 1/27/2006 6:34:56 AM
Question that I hope someone can direct me. I do alter table command to (mostly) add columns to an existing table, but sometimes to change the size of an existing column (such as char(30) changing to char(50)). I remember reading that changing the sze will actually leave the 30 character ar...more >>

Linked Servers
Posted by Eric D. at 1/27/2006 5:54:04 AM
Hi, I'm trying to create a linked server of DB2. I've tried using the providers "IBM OLE DB Provider for DB2" and "Microsoft OLE DB Provider for ODBC Drivers" but I just don't know what to put in the fileds to create a valid connection. Can someone give me an example that would work for me....more >>

Monitoring Changes in SP, Table and Views - Server Objects
Posted by Mehul Gurjar at 1/27/2006 5:09:03 AM
Hello, I would like to monitor the changes in current SQL Server Database Objets like Tables, Stored Procedures, views and Triggers. I would like to store the information in one table and would like to get the report. How can i do this? ...more >>

Optimizing queries
Posted by rameshsaive NO[at]SPAM gmail.com at 1/27/2006 3:00:31 AM
friends, I have the following table with atleast 4,00,000+ records & i want to update some of its fields with the below logic. STOCKEXCDOWNLOAD I've ran the below query in query analyzer with no indexes on this table. the time taken is about 40 secs. UPDATE StockExcDownload SET CalC...more >>

Inserting into joined tables
Posted by Ant at 1/27/2006 2:38:03 AM
Hi, I need to insert into a set of joined tables. I'm using a select statement as the target 'table' into which it will insert into: INSERT into dummy as ( SELECT e.name, e.email, d.dept_name, l.location_name FROM Departments d INNER JOIN Emplo...more >>

Problem with Cursors
Posted by shiva at 1/27/2006 2:17:53 AM
Hi All, i have a problem while using the Cursors, actually i have main cursor, let say "ParentCur" and i'm definding the another cursor in the Parent Cursor say "childCursor" in the child cursor i'm checking for some validations, if 'a'='b' raiserror ('Both Are Not Of Same Type',16,1...more >>

Recompile Table Functions?
Posted by Steve at 1/27/2006 2:03:01 AM
We regularily use functions to return indexed table variables (for a range of dates, products and stores built for the parameters passed in). These are then used to join to tables to return sales information etc. Occassionly, we need to recompile the stored procedures using sp_recompile, but ...more >>

Attaach 2000 data file from network drive
Posted by Banu_tr at 1/27/2006 12:30:02 AM
Hi How can I attach mdf file without copying it to local disk. I dont have enough space on the server which I have to attach db. But there is enough space on an other server in the network. Thanks Banu...more >>

schema
Posted by Alan at 1/27/2006 12:28:02 AM
Hello, I am making a database migration from Sybase SQL Anywhere to SQL server 2005. Under sybase I had functions I use in VB6 applications, and in VB6 I call these functions directly by their names ie: select fGetText(1) but with SQL server I have to specify the schema before the function n...more >>

UNION the results from two stored procedures
Posted by Scott A. Keen at 1/27/2006 12:23:37 AM
I have two stored procedures which return results in the same column format. I would like to have a third stored procedure which will union the results of the two stored procedures, eliminate duplicates (distinct) and put the results in order by userid. pseudocode: CREATE PROCEDURE [sp_unio...more >>

Field Alias as Function
Posted by John at 1/27/2006 12:00:00 AM
I want to change the alias of the fields below to the current month and the month +1 ie datename(month, getdate()) and datename(month, dateadd(mm,1,getdate())), so instead of '1' and '2' I have January and February Select case when p1.ExpectedDeliveryDate >= @Start and p1.ExpectedDelive...more >>

Convert DateTime to String Preserving Format
Posted by Ben at 1/27/2006 12:00:00 AM
Hi We have some datetime fields that hold poor data that we want to clean up on the fly (a poor third party system requires it like this). e.g. the field holds just the time: "18:18:23" which is converted to a date time (with the time as the date) when we select it. We have developed code...more >>

Log file size
Posted by krygim at 1/27/2006 12:00:00 AM
I find that the following commands successfully decrease the size of the log file: - Backup Log MyDB With Truncate_Only - DBCC SHRINKDATABASE (MyDB) However the following commands (exec one after one) can't decrease the size of the log file: - DBCC SHRINKDATABASE (MyDb, TruncateOnly) - DBCC...more >>


DevelopmentNow Blog