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 > august 2007 > threads for tuesday august 21

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

Import using openrowset limitation of 2mb
Posted by Nikolajus at 8/21/2007 11:32:01 PM
Hello! I need to import 6.5MB .xml file in SQL Server 2005. So, I've created a table: create table eb_main_itemvalues_xml (id int, v xml) And executed command: insert into eb_main_itemvalues_xml (id, v) select 2, * from openrowset ( bulk 'C:\eb_main_itemvalues_export.xml', single_bl...more >>


can you alter a package variable from within a stored procedure?
Posted by BRLAdbaguy at 8/21/2007 8:02:10 PM
I'm only a few months into SQL 2005, but I'm at a stopping point with a small project I'm working on. The objective is to allow testers to run packages that can load sample data into tables without having to bother the developers. So far, my solution is to deploy the packages to the file syst...more >>

GROUP BY question
Posted by lorenzdominic_ NO[at]SPAM hotmail.com at 8/21/2007 5:44:58 PM
Hi I have a table (A) with various columns however one column I wish to GROUP BY has numbers (N) from 1-10. I want to group the numbers 1-3, 4-6, and 7-10. It would be nice to call them Group1, Group2, Group3. So I thought of this for starters? SELECT N FROM A WHERE (N = 1 OR N = ...more >>

Assigning variable on a subquery
Posted by at 8/21/2007 5:38:33 PM
I want to assign a variable from a sub query and then use that query to do a calculation in the main query, for example: Declare @Var1 decimal (5,3) Select var_id, name, forename, rate, @Var1 = ( select top 1 from exch_rate where rate_id = var_id and exch_date > order by var_id ), rat...more >>

Novice: WHERE COLUMN = NULL?
Posted by Peter at 8/21/2007 4:54:01 PM
Hello, Thanks for reviewing my question. I have a table where some of the rows have NULL in a particular column. I would like to select only these but when I put WHERE Acolumn=NULL none are displayed. What am I doing wrong? Many Thanks Peter...more >>

Tricky self join
Posted by Jay at 8/21/2007 3:54:35 PM
I have the following tables and query that I'm working with. At the bottom is the simple query that returns 2 rows and a couple of (poor) try's at getting the result I need.: 1 A001 Acne 1 3 1 1 A001 Face Excluding Eyes 4 5 2 However, the Taxonomies table contains a FK that refers to itse...more >>

SQL Query Question
Posted by Isaac Alexander at 8/21/2007 3:53:49 PM
I wrote a stored procedure that uses a cursor and a temp table to return values. I would like to change this to a single query if it is possible to improve performance. The source data looks like this. Sorted by ID then DateValue. ID DateValue TextVa...more >>

Restore problem... "The media family on device '%ls' is incorrectly formed"
Posted by Mike C at 8/21/2007 3:47:37 PM
A client keeps sending me .BAK files. A couple have worked, but I have gotten this error on many: Error 3241 Severity 16 State 1 The media family on device '%ls' is incorrectly formed. SQL Server cannot process this media family. If I view the contents of the .BAK (in Enterprise Manager), ...more >>



Database Diagram in SQL Server Management Studio
Posted by PSULionRP at 8/21/2007 1:18:09 PM
Back in the day, when we used to use Enterprise Manager, I could right click on "Diagrams" and then click on "New Database Diagram". This allowed me to get some nice table layouts I could use. We have recently moved over to SQL Server Management Studio and when I right-click on "Database Di...more >>

comma delimited list of values
Posted by martino at 8/21/2007 12:58:04 PM
Hello, I am trying to create a comma delimited list of values from a column table containing a changing number of rows, could one, two,....,n number of rows. This column contains descriptions of projects. Insert the result of this select into one column one row temptable that would ho...more >>

How to script out a table definition to a file programmatically?
Posted by newToSql at 8/21/2007 12:53:28 PM
hi, with sql 2005, how to script out a table definition to a file programmatically (tsql, or smo, or?) Thanks ...more >>

Changing rows to columns
Posted by David at 8/21/2007 12:34:01 PM
Hello experts, I am trying to select row values and then updating it to each column on a different table. Let me take an example to describe it clearly create table #A (RecID tinyint, String varchar(1)) create table #B (col1 varchar(1), col2 varchar(1), co...more >>

What is meant by a SQL "Instance"
Posted by PSULionRP at 8/21/2007 12:24:04 PM
What is meant when someone refers to a SQL "Instance"??? Thanks in advance for your help. PSULionRP...more >>

Instead Of trigger is blocking/suppressing my Error Trigger
Posted by Rich at 8/21/2007 11:08:01 AM
One trigger in my table checks a Date field on data insert. If the Date value is incorrect then rollback the entire transaction during a data Insert and display an error message. If everything is correct for the dataset being inserted then the Instead Of trigger is supposed to insert the ro...more >>

"WHERE constant" not the same as "WHERE @constant" ???
Posted by Ian Boyd at 8/21/2007 11:02:23 AM
We've encountered something odd when testing queries on a customer's database. i'll supply more detailed dll later, but the basic problem is that SELECT * FROM Table WHERE Field = Value performs MUCH differently than DECLARE @SomeGUID uniqueidentifier SET @SomeGUID = '{a guid goes her...more >>

Could not allocate ancillary table for view or function resolution.
Posted by Ned Balzer at 8/21/2007 10:42:51 AM
Hi all, I am getting this error: [Microsoft][ODBC SQL Server Driver][SQL Server]Could not allocate ancillary table for view or function resolution. The maximum number of tables in a query (260) was exceeded. I know it's because in my application I have views on views on views and I need ...more >>

SELECT DISTINCT woes
Posted by dhnriverside at 8/21/2007 9:50:02 AM
Hi everyone, Having a problem with a select distinct. Table: Stories StoryID | Headline | PrimaryTag --------------------------------------------------- 1 | 'Story Heading 1' | 'COM' 2 | 'Story Heading 2' | 'EDU' 3 | 'Story Heading 3'...more >>

SQL Question
Posted by D Lee at 8/21/2007 9:09:20 AM
I would to write a query that returns 0 row if any of the rows contains StatusID = 1 and returns the row with StatusID = 4 when there is no rows with StatusID = 1. I thought it would be really easy ( I am sure it is for db folks), but I am pulling my hair here. Any help will be greatly appreciat...more >>

Export data from XML datatype column to file
Posted by labsRcool NO[at]SPAM community.nospan at 8/21/2007 8:36:30 AM
How do I create a stored procedure that exports xml data and saves it to a file? I created a stored procedure that takes a xml file on the network and saves to a SQL Server 2005 table. Specificaly, it saves the entire xml file into a xml datatype column. I know want to reverse this trans...more >>

Converting an Access query to T-SQL
Posted by AndyG at 8/21/2007 8:22:04 AM
Hi One of my managers has a SQL view that returns the following columns from a table in Microsoft CRM activity (uniqueidentifier) recipient (uniqueidentifier) importance (int) between 1 & 4 For each activity, there can be many receipients, each of which will have been given import...more >>

SQL Server Management Studio---Object Explorer---Open Table to Tex
Posted by PSULionRP at 8/21/2007 7:48:01 AM
Within SQL Server Management Studio and Object Explorer, if I open a table within Object Explorer, is there any way to change the results to Text rather than Grid so that I can copy and paste the results into an Excel spreadsheet??? The "SQL Editor" buttons are not available and thus the i-...more >>

I want to use NOT IN, but I've heard it's bad?
Posted by musosdev at 8/21/2007 7:28:01 AM
Hi I have a situation where I think NOT IN is the best way of achieving a solution. However, I've heard it's bad (slow), so I wondered how else I could do it? I need to SELECT the top 6 items in a table, AFTER the 1st one. So.. SELECT pk, [fields] FROM [table] WHERE pk NOT IN (SELECT TO...more >>

How to optimize indexes
Posted by Stephane at 8/21/2007 6:56:00 AM
Hi, I have this table: CREATE TABLE [dbo].[tbl_logs]( [id] [int] IDENTITY(1,1) NOT NULL, [dateAdded] [datetime] NULL CONSTRAINT [DF_tbl_logs_dateAdded] DEFAULT (getdate()), [localTime] [datetime] NULL, [isPageView] [tinyint] NULL CONSTRAINT [DF_tbl_logs_isPageView] DEFAULT ((1)),...more >>

SQL Server Managment Studio Object Explorer and Table
Posted by PSULionRP at 8/21/2007 6:50:03 AM
Within SQL Server Managment Studio and Object Explorer, you can explore Tables. But unlike Enterprise Manager, it doesn't seem as though you can right-click on the table and query it and sort it. My biggest problem is how can you sort a table within Object Explorer in SQL Server Management Stu...more >>

SQL Security in DMZ
Posted by David Wimbush at 8/21/2007 6:06:50 AM
I have just been handed the role of DBA and, while I think I'm pretty solid on SQL security within the domain (I'm a Windows app developer), the web side of things is fairly new ground for me. I would really appreciate some help. We have an IIS 6 server in our DMZ running web sites and web se...more >>

Primary key selection
Posted by Kev at 8/21/2007 6:06:05 AM
Hi, We have a database with very few primary keys defined. In order to implement transactional replication with updateable subscribers we need to define primary keys on all tables. I need some advise as to whether it's better to use natural primary keys or introduce artificial identity colu...more >>

Merge replication: How to avoid duplicates of records?
Posted by yashgt NO[at]SPAM gmail.com at 8/21/2007 5:19:02 AM
We have a simple problem: We have a table Assets[asset_id, title] and a table Asset_Versions[asset_id, version_no]. In addition, there are columns added by replication for storing the ROWGUID. After synchronzation, assume both Node1 and Node2 have Assets(1,'XYZ') and Assets_Versions(1,1) Bef...more >>

Use Coalesce to Format Comma-Separated String
Posted by creed1 at 8/21/2007 4:34:00 AM
I am using the coalesce function in sql server to combine the values in a table column into a single comma-separated string. If I write the code like this, it works perfectly... DECLARE @OrdersList varchar(1000) SELECT @OrdersList = COALESCE(@OrdersList + ', ', '') + order_type ...more >>

grant public rights to stored procedures
Posted by Michel Posseth [MCP] at 8/21/2007 2:40:03 AM
Hi , I just finished a VS.Net program wich uses 85 stored procedures \ it works fine however not at user level , this is due to Access rights i was so stupid to forget to grant Public execute rights to these stored procedures there are three servers with these 85 stored procs my...more >>

global variables
Posted by Kjell Brandes at 8/21/2007 2:22:00 AM
Is there any way to declare your own global variables unique for session in sql server? regards Kjell Brandes...more >>

Update 'text' column with a second table?
Posted by at 8/21/2007 2:21:53 AM
Dear group, I am having trouble updating a column (in SQL 2000) of the type 'text' from another table. For example, let's say I have two tables: tblDest with columns: IDNum as integer primary key, TextDest as text == ======= 1 OldData1 2 OldData2 3 OldData3 4 OldData4 tblSrc wi...more >>

How to execute a batch file from a Stored Procedure
Posted by bowen at 8/21/2007 1:12:07 AM
Hello, Just wondering how you can execute a batch file from a stored procedure. Can I find out what the syntax is assuming the batch file sits locally on the SQL Server? Thanks! Regards, -Alf...more >>

Notifying the external world from SQL server ... best practices ?
Posted by Sam Samson at 8/21/2007 12:00:49 AM
Hi all, I am searching for a way to notify my application that a 'change' has happened in my DB .. i.e. insert happens, trigger fires, slicing and dicing then tell my app things have happened. I assume this is not an uncommon sort of thing to want to do rather than have an app poll th...more >>

A question on Comparing records...VERY URGENT...
Posted by Shashi at 8/21/2007 12:00:00 AM
Hi All, We have a unique problem at hand. We have a large table with close to 200 fileds(all types int, bool, character). Now there are lots of records(more than 100000). Each record has two uniq fileds (DOCID, ITEMID). Now DOCID's representats the Document ID which hosts all the relevant ...more >>


DevelopmentNow Blog