all groups > sql server programming > october 2007 > threads for monday october 1
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
Cannot create new connection because in manual or distributed tran
Posted by Linda at 10/1/2007 9:41:01 PM
Hi,
I'm working in PB10.5.1/MSSQL Server2005(OLE DB/SQLNCLI)
environment.
In PB code, there is a cursor to retrieve data from db.
There is another function call within the loop to fetch the
value into variables. This function selects rows from db.
With MSS there was no problem, but with ... more >>
Invalid Column Name
Posted by Cindy Mikeworth at 10/1/2007 7:53:05 PM
What's wrong with this statement? I'm getting an invalid column name on
Division and Department. I'm trying to get a count of all unique
combinations of the three columns.
select count(employid), left(divisioncode_i,1) as division, jobtitle,
left(deprtmnt,2) as department
from upr00100
... more >>
declare a variable for entire batch
Posted by Pat at 10/1/2007 7:31:18 PM
Hi Friends,
I read somewhere that there is a way in SQL 2005 that will let you the
declare a variable and use it within entire batch, even though you use
GO command in the same batch
do you know of this new future on sql 2005 ?
Thanks in advance,
Pat
Example :
-----------------------... more >>
Do you know what the Sql CTE really is?
Posted by Steve Dassin at 10/1/2007 6:59:18 PM
Probably easier to read @
http://beyondsql.blogspot.com/2007/10/sql-whats-really-with-with.html
But reprinted here:
From Sql Server 2005 Bol for WITH CTE (common_table_expression):
'Specifies a temporary named result set, known as a common table expression
(CTE).
This is derived from a si... more >>
The Two Standards of the Sql CTE
Posted by Steve Dassin at 10/1/2007 6:50:36 PM
Probably easier to read @:
http://beyondsql.blogspot.com/2007/10/sql-two-standards-of-sql-cte.html
But reprinted here:
Sql really has two standards. There is the ANSI sql standard and then
there is the DOUBLE standard.
This example uses Sql Server 2005 and specifically the CTE (common tab... more >>
Create Database fials
Posted by Bill at 10/1/2007 3:01:01 PM
Hello,
The create database Transact-SQL statement seems to not like spaces in the
filespec parameters.
The following code fails.
string strCmd= "CREATE DATABASE inService ON PRIMARY
( NAME = N'inService_Data', FILENAME = N'c:\Program
Files\inService\inService_Data.mdf' , SIZE = 16793... more >>
Manage data between 2 databases
Posted by Claudio(BS) at 10/1/2007 2:51:01 PM
Hi all,
I would like to update some row of a table in a database A when i find some
row in a table in a database B.
Is it possible with TSQL without using temporary tables?
I have declared the variables and the cursor but surely I miss something
because the procedure is not working.
Can some... more >>
I need a table valued function that returns records from two possible tables...
Posted by 0to60 at 10/1/2007 12:15:26 PM
In my db I have archived data and current data. I would like my sprocs
to be smart enough to choose the correct table, but without having
IF...THEN...ELSE statements all over. I'd like a nice, table valued
function to do the selecting. So, my code would be like:
SELECT *
FROM SomeFu... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
SQL Server Express CPU limitations
Posted by Mark at 10/1/2007 11:53:03 AM
Hello,
SQL Server Express is limited to one CPU. Does this mean it can only be
installed on a machine with a single CPU or if
it's installed on a multiple CPU machine will it make use of only one CPU?
Thanks in advance,
Mark
... more >>
datetime insert into error
Posted by JR1 at 10/1/2007 11:37:00 AM
Hello,
I think I have a simple question but I cannot find the resolution.
I am using an Insert Into statement to insert a few columns from one table
to another table. The problem is when I add the datetime column into the mix
I get the following error:
Arithmetic overflow error conve... more >>
Query to find duplicate rows
Posted by Hassan at 10/1/2007 11:25:41 AM
Are there any examples out there to find duplicate rows ?
I may want to find those rows that have duplicates in a single column or
duplicates in more than one column ?
Thanks
... more >>
Need help with a query
Posted by Ashton Tate at 10/1/2007 10:30:10 AM
Here is the layout of the billing table:
CREATE TABLE [dbo].[Billing](
[BillingID] [char](10) NOT NULL,
[Status] [int] NULL,
[ClientID] [char](10) NULL,
[MatterNo] [char](10) NULL,
[BillingDate] [datetime] NULL,
[TRateID] [char](10) NULL,
[ERateID] [char](10) NULL,
[TQuantity] [in... more >>
Running reporting queries without killing the production server.
Posted by fulgore66 NO[at]SPAM gmail.com at 10/1/2007 9:22:23 AM
I am having a hard time figuring out how to run intensive report
queries against our production database server without killing it for
all the other users.
This is an insurance database with millions of records. We have
several reporting queries that will take several minutes to run. I
don'... more >>
Is this a bug? - Change the Collation of a Not Null Text column.
Posted by mark4asp at 10/1/2007 8:13:05 AM
This doesn't work:
Alter Table Mandate Alter Column Report Text Not Null Collate
SQL_Latin1_General_CP1_CI_AS
It has to be done like this:
Alter Table Mandate Alter Column Report Text Collate
SQL_Latin1_General_CP1_CI_AS
Alter Table Mandate Alter Column Report Text Not Null
or does ... more >>
Help with error handling
Posted by Peter Hyssett at 10/1/2007 6:58:02 AM
Hi.
A Stored Procedure is producing results I did not expect, and the problem
appears to be in the evaluation of an IF condition. The coding is something
like this:
BEGIN TRANSACTION
....
IF (EXISTS (SELECT...))
BEGIN
INSERT...
SET @errcode = @@ERROR
IF (@errcode <> 0) ... more >>
check if bitvalue is in integer
Posted by Frans at 10/1/2007 6:38:00 AM
I have an integer which is the summation of several bit-values.
For example:
bit(0)=1
bit(1)=2
bit(2)=4
bit(3)=8
If the integer field is 15, I know that is has bit(0)-bit(3) in them.
If the integer field is 3, It contains bit(0) and bit(1)
If the integer field is 10, It contains bit(1) ... more >>
Default value
Posted by Mikael at 10/1/2007 5:02:00 AM
Hi
I have a table with a code field that is varchar(16)
I would like to have a default value of 'new' + the number of rows that
starts with 'new' in that tabel.
I tried:
ALTER TABLE dbo.intr_curr ADD CONSTRAINT
DF_intr_curr_code DEFAULT ('new' + CONVERT(VARCHAR(2),(SELECT TOP 1
COUNT(... more >>
Alternate to cursors
Posted by srirangam.seshadri NO[at]SPAM gmail.com at 10/1/2007 12:10:33 AM
Hi,
I have a situation where I am loading data into a staging
table for multiple data sources. My next step is to pick up the
records from the staging table and compare with the data in the
database and based on the certain conditions, decide whether to insert
the data into the database... more >>
Last try: Polling the network for SQL servers, including named instances
Posted by Quentin Ran at 10/1/2007 12:00:00 AM
Hopefully I do not end up empty-handed.
Hi group,
I am trying to get a list of SQL Server installations running on the
network. I tried to use sqlcmd -L (or osql -L). However, when I do this
from my box the named instances do not show up, whereas when it is run from
a server box those ins... more >>
Help With Ordering
Posted by Mick Walker at 10/1/2007 12:00:00 AM
I have the following Query
Select convert(char(10), DateViewed,111) AS groupDate, Count(ViewerID)
as Count from dbo.ViewRecords
where UserID = @UserID
And convert(char(10), DateViewed,111) < DATEADD(d, 0 ,GETDATE())
And convert(char(10), DateViewed,111) > DATEADD(d, -20 ,GETDATE())
group ... more >>
Grouping Records By Day
Posted by Mick Walker at 10/1/2007 12:00:00 AM
I have the following select statement:
Select DateViewed, Count(ViewerID) from dbo.ViewRecords
Group by DateViewed
DateViewed is a datetime column, so it returns results like:
2007-09-16 16:14:20.060 1
2007-09-23 22:18:32.100 1
2007-09-26 21:32:44.887 1
2007-09-26 21:33:01.807 1
2007-0... more >>
How to LOCK a table for INSERT and UPDATE, but not SELECT for duration of SqlTransaction?
Posted by sticky at 10/1/2007 12:00:00 AM
Hi
I need to be able to lock a table against INSERT and UPDATE, but not
SELECT, for the duration of a transaction.
The transaction will be defined at the application level in c#, and
then use stored procedures to make multiple selects and then an
insert.
What is the best way of doing this?
... more >>
XP_SMTP_SendMail extended stored procedure
Posted by kay at 10/1/2007 12:00:00 AM
Hello,
I am using the extended stored procedure XP_SMTP_SendMail to send email
from within SQL Server however there is one problem I have encountered and
hopefully someone maay be able to give me some advice.
I have set up a scheduled job which executes a stored procedure (step 1), it
a... more >>
|