all groups > sql server programming > april 2006 > threads for tuesday april 18
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
How can I swap rows to columns in a SELECT statement
Posted by Martin Trabold at 4/18/2006 11:34:40 PM
I've got dynamically changing columns in a table. One way is to define many
parameter columns in this table with the datatype nvarchar and a second
table that is defining the datatype, max and min values of these parameter
fields.
Because I want to have more flexibility I think to save the ... more >>
Daylite saving time problem
Posted by Alexander Korol at 4/18/2006 10:50:02 PM
Hello
I am using SQL Server 2000, SP4
I am calculating number of hours passed between two dates. Both dates have
time set to 00:00:00. I use datediff function it works ok unless the time
interval I pass includes date when time is changed due to Daylite Saving Time
(DST) issue. Instead of... more >>
Insert 200 rows in one insert statement
Posted by hon123456 at 4/18/2006 9:57:24 PM
Dear all,
I need to insert 200 rows data with the same fields data.
e.g.
Column-A Column-B Column-C
A B
C
A B
... more >>
How to insert ten rows in one insert statement
Posted by hon123456 at 4/18/2006 9:48:17 PM
Dear all,
I want to insert 10 rows data as follows
column-A column-B column-C
A A
1
A A
2
A ... more >>
is there any limit to how long of a string SqlDataReader.GetString() can return?
Posted by Daniel at 4/18/2006 8:42:01 PM
is there any limit to how long of a string SqlDataReader.GetString() can
return?
... more >>
CHARINDEX returns zero in TEXT column
Posted by Alan Smithee at 4/18/2006 8:35:02 PM
I'm running into an issue where CHARINDEX on a text datatype column returns 0
if the expression I'm searching for exists at a position greater than 8000.
For example:
use pubs;
select charindex('New Moon Books',pr_info,8000)
from pub_info
returns zero, even though I know 'New Moon Books... more >>
Referencing another Database in a query
Posted by Brian Patrick at 4/18/2006 7:16:14 PM
I'm in query analyzer and I have 2 databases on this same server that I want
to reference in a query. How do I go about doing that? In other words, I
want to create an insert query which takes records from one database and
inserts them into a table in another database.
Thanks,
Brian
... more >>
How to get a previous rows result to currect rows for calculation
Posted by fong01 at 4/18/2006 7:06:02 PM
Hi,
How to getting a previous rows result to currect rows by using sql query,
like below example...
ColsA Rows1
ColsB Rows1
ColsA Rows2
ColsB Rows2
ColsA Rows3
ColsB Rows3
ColsA Rows1 * ColsA Rows1 = ColsB Row1
Next
ColsB Rows1 * ColsA Rows2 = ColsB Row2
Next
ColsB Rows2 * ColsA... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
How to capture out param?
Posted by brett at 4/18/2006 6:27:40 PM
I'd like to execute a stored procedure that needs 5 parameters. One of
them is an OUTPUT parameter. What does the
exec sp_name...
code, executed in QA SQL Server 2000, look like for this? Also, if the
OUTPUT parameter is declared last in the spoc, how can I call it by
name as the first p... more >>
SQLDMO: Database SpaceAvailableInMB reports differently in SQL2005
Posted by Mark Findlay at 4/18/2006 5:15:42 PM
My C++ SQLDMO app correctly reports the database property SpaceAvialableInMB
on SQL2000, but is way off on SQL2005.
For example, in SQL2005, it reports SpaceAvailableInMB as 108MB, but viewing
the database's property pages displays a space available as 32Meg.
I am just using the SQLDMO Dat... more >>
Will it be faster to use CLR UDF?
Posted by nick at 4/18/2006 4:02:01 PM
Current situation, an extended stored procedure in C++, which accept around
100 input parameter, some calculation (no database, I/O, etc) and ouput about
100s parameter.
To use the extended stored procedure, open a cursor on a big table with
millions of rows and pass column values as para... more >>
Connect to SQL Server over the internet
Posted by Jose Perdigao at 4/18/2006 3:59:04 PM
Hi,
Computer A is where is installed SQL server 2000 and the BE. Computer B, I
have the FE (ADP in access 2003). The both computers are connected the
internet.
So, how can I connect to SQL Server over the internet? I mean, I want
connect my FE Computer B) to BE (computer A).
I listen somet... more >>
rtrim in sql server 2000
Posted by tamashee NO[at]SPAM yahoo.com at 4/18/2006 3:24:13 PM
Hi,
What is wrong with the following query?
select a.name, rtrim(a.name) from (
select top 100 name from dbo.table1 )a
whre table1 has the following in name column
A.B.xyz<space>
AB.xyz<space>
and so on...
When i cut and paste the result set from query analyzer into Exce... more >>
Cannot get serverproperty
Posted by David Chase at 4/18/2006 3:05:46 PM
Using SQL2k. When I run the command below in query analyzer I get 3 columns
of info. However, when I run the same SELECT from code I get nothing. Can
anyone help? Thanks.
SELECT SERVERPROPERTY('productversion') As SQLVersion,
SERVERPROPERTY('productlevel') As ProdLevel, SERVERPROPERTY('... more >>
Joining 2 tables via 3rd table
Posted by Troy Dot Net at 4/18/2006 2:23:02 PM
I've been squeezing my noggin trying to figure this problem out with little
to show for it though I admit my SQL ability is dismal.
I have 3 tables as follows (greatly simplified here):
tblProperties
int ID
1001
1002
1003
tblOwners
int ID
2001
2002
2003
tblPrope... more >>
Q280468 Bug/Error SELECT with GROUP BY ALL still occurs in 2000, 2005!
Posted by Shawn at 4/18/2006 2:16:48 PM
I recently had the misfortune of writing a query which came up with the
following error:
Server: Msg 8624, Level 16, State 24, Line 11
Internal SQL Server error.
Article Q280468 directly relates to this issue (last reviewed October
16, 2003) and STILL IS NOT FIXED. SQL 2005 gives a COMPL... more >>
CLR UDF deploy failed
Posted by nick at 4/18/2006 2:05:02 PM
I got the following error message:
Deploying File: c:\work\apper\debug\RSql.dll
Deployment to database failed
Function signature of "FillRow" method (as designated by
SqlFunctionAttribute.FillRowMethodName) does not match SQL declaration for
table valued CLR function'MyUDF' due to column 1.... more >>
Put constraint on this
Posted by Art at 4/18/2006 1:54:02 PM
I have three tables:
1. SoftwareSupported,
2. VersionsSupported,
2. MappingTable (this one marries the two)
SoftwareSupported(SofwareID[PK], SoftwareName)
VersionSupported(VersionID[PK], SoftwareID[FK], VersionDesc)
MappingTable(AppID[PK], SoftwareID[PK], VersionID)
Facts state that:
1. ... more >>
N - curious?
Posted by CR at 4/18/2006 1:47:50 PM
Looking at an if exists statement created by SQL Enterprise Manager such as:
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[DeleteAllData]') and OBJECTPROPERTY(id, N'IsProcedure') =
1), what does the N do? I've seen cases where it is and isn't necessary, but
I cannot f... more >>
add words to FTS dictionary
Posted by cindy at 4/18/2006 1:20:02 PM
we are medical company I need to a some words to the dictionary that SQL
containstable uses how can I do it? These are not noise words example the 2
letters SP is a word we use over and over also HiCNR
--
cindy... more >>
My convert vchar to numeric - why doesn't it work?
Posted by antsql at 4/18/2006 12:58:15 PM
I am trying to convert a 10 character field (all records are 10 digits,
no letters) into a 10 digit numerical field. I have been trying for
some time now ;)
Can someone see why this wont work:
UPDATE tabletoupdate
SET newfieldnumeric = convert(substring([oldvcharfield] as numeric
(10,0))
... more >>
Frequency of joins between two tables in a database.
Posted by Naana via SQLMonster.com at 4/18/2006 12:48:41 PM
Hi All,
Is there anyway to tell the frequency of joins between two tables in a
database?. I need help on this one.
Thanks.
--
Message posted via http://www.sqlmonster.com... more >>
Select from Two Tables each Column that is Different
Posted by tom at 4/18/2006 12:05:08 PM
Oops - posted this to the wrong ng. This is more appropriate:
I have two tables, Table A and Table B. For the sake of this, we will
say that their DDL is identical. They have an associated key, ID.
I need to return for each ID only those columns that are different.
A plain English state... more >>
List tables used in a SP
Posted by George Lake at 4/18/2006 11:40:24 AM
Is there a way to list all tables used in a SP?
I have a very large DB that has a couple hunderd tables and I need to know
what tables are used by about 85 SP.
Thanks.
G.
... more >>
Text data type support in trigger, SQL 2005
Posted by Christian Perthen at 4/18/2006 11:30:40 AM
Hi,
Is text datatype supported in triggers in SQL 2005?
Thanks
Christian
... more >>
Scripting Primary Key creation with DTS
Posted by Elliot Rodriguez at 4/18/2006 11:14:29 AM
I am having a hard time figuring out how to include my PK constraints in the
Import/Export wizard.
I have a large number of tables that I am exporting to a production machine.
The tables on that machine should, in many cases, have the tables recreated
instead of have data appended to them.
... more >>
Query Parallelism (maxdop)
Posted by zomer at 4/18/2006 11:13:35 AM
I have 4 processor SQL server. When I run this query in query analyzer
(two table joins with weekly aggregation approx 500,000 rows each) ...
it takes only 7 seconds.... when I run it in a stored procedure.... it
takes about 60 minutes. I dont see parallelism in the execution plan of
SP.... I ha... more >>
SQLDMO.dll Redistribution Best Practice
Posted by russ.haley NO[at]SPAM gmail.com at 4/18/2006 10:44:09 AM
I have a .net application that is using SQLDMO.dll and I'm wondering
about best location to install it. Right now we just add it to our
application path but I have seen reference to others creating the
Microsoft Sql Server directory and dumping it in there.
Does anyone have any insight about a... more >>
Bulk Insert from Memory (without using physical file)
Posted by don larry at 4/18/2006 10:34:26 AM
Greetings,
In SQL Server (7, 2000), can we bulk insert data from a data structure
(any possible kind) from the memory without using physical file as
source.
Thanks in advance,
Don
*** Sent via Developersdex http://www.developersdex.com ***... more >>
Transact-SQL
Posted by anm at 4/18/2006 10:21:02 AM
I am in the process of trying to extract data from a column and insert into
another table.
I need to extract the bold characters within each attribute of the column.
It begins at the 15th character and 3 characters long.
H 5555 I 12345WAT F6
The database has been moved from MS Access a... more >>
Auto-Increment
Posted by Burtamus at 4/18/2006 10:17:07 AM
I'm creating a new SQL 2005 Express database and want to have a Customers
table. How do I auto-increment the CustomerID field? Programming in VB.Net
2005.
I'm new to SQL, so go easy on me please ;-)
--
TIA, Burt
===============================
There's nothing so permanent as
... more >>
Error Handling in procs etc.
Posted by Roger Twomey at 4/18/2006 9:34:26 AM
In the last hour a few people have referred to the site: =
http://www.sommarskog.se/error-handling-II.html
I am trying to figure out the error checking. I used the document and =
the bol. For example, I cut this from the bol:
USE pubs
GO
UPDATE authors SET au_id =3D '172 32 1176'
WHERE au... more >>
data replication
Posted by Reza Razavipour at 4/18/2006 9:18:51 AM
To all,
I am totally new to database programming and SQLServer. I need to find out
how to "copy" the data in database 1 to the database 2. How, in general one
does this type of "copy" or "migration". Is there a SQL standard way to do
this?
Thanks in advance.
Reza
... more >>
C# UDF project call C++ model (SQL Server 2005)?
Posted by nick at 4/18/2006 8:42:02 AM
I have some legacy C++ code and I am creating a C# project for UDF function
and another project for C++ classes. I always got error message when I am
trying to add reference to the class lib project:
A reference to 'classModel' could not be added. SQL Server projects can
reference only othe... more >>
CLR function performs worse than T-SQL
Posted by JasonDWilson at 4/18/2006 5:26:03 AM
I have several functions written that simply format dates. I was told that
this string manipulation kind of stuff was much more efficient in the C# than
in T-SQL, but I have written the same function in C# and ran it in a timed
performance test calling it in cursor loop and the T-SQL function... more >>
SQL 2005, ADODB & Print Statement behaviour
Posted by Rui Quintino at 4/18/2006 4:05:01 AM
Hello there,
After connecting a legacy access application to sql 2005 (prior connected to
a database in sql 2000, the database remains identical) I founded this
strange behaviour :
print messages, or even sql warnings cause recordsets not returning any
information
example, this works:... more >>
show which material was most ordered
Posted by Xavier at 4/18/2006 3:51:02 AM
hello,
i have a table Orders with 3 columns
OrderCreationDate(varchar(10)
Material int
OrderQuantity int
in the example there is only used material (1,2,3,4)
example
20060401 1 10
20060401 4 1
20060401 2 5
20060404 1 11
20060405 4 10
20060405 3 13
20060408 2 24
i want t... more >>
looking for a T-SQL Parser for .NET
Posted by google NO[at]SPAM eduard-ralph.de at 4/18/2006 3:31:35 AM
Hi,
sorry for the cross-post but I'm a bit unsure on which side of the line
I could find such things. I'm looking for a T-SQL Parser in .NET that
produces an abstract syntax tree. Ideally it should also be able to
parse Stored Procedures as well. I would hate to have to write one
myself but w... more >>
Add Images to table of SQL Server 2005
Posted by frank.van.der.schoot NO[at]SPAM relitech.nl at 4/18/2006 3:15:55 AM
Dear All,
How can I assign an image to an image-field in a SQL Server 2005
Express with the tooling of Microsoft (I have Visual Studio 2005 Team
edition). I cannot find a way.
Further I tried to write an small program with an DataGridView, but
here I can fill in all other fields except the... more >>
SQL Server 2005, .Net / CLR Support and Event Handling
Posted by TCook at 4/18/2006 2:39:30 AM
Hello,
I was wondering if under SQL Server 2005 and its new support for developers
if there are events exposed in a traditional sense that can be trapped for
using C# and VB.Net?
Thanks & Regards,
TC
... more >>
Transactions
Posted by Roger Twomey at 4/18/2006 12:00:00 AM
I was trying to write a stored procedure last night. I figured I could break
it out into two Transactions to allow for faster release of resources.
For some reason I could not. My transaction format was basically:
Declare variables
Begin Tran
Code
Code
Code
Commit
If @@... more >>
Structure M:M
Posted by McHenry at 4/18/2006 12:00:00 AM
What is the best way to create a M:M relationship between a column and
itself.
For example I have a table of suburbs and I would like associate with each
suburb it's surrounding suburbs which effectively will be a M:M relationship
with itself ?
CREATE TABLE Suburbs
(
SuburbID INT IDE... more >>
Formatting Dates
Posted by McHenry at 4/18/2006 12:00:00 AM
Why would this not format a date into the dd/mm/yy format ?
CONVERT(datetime, Actioned,103) As Actioned
Actioned is a column of type datetime.
Thanks in advance...
... more >>
About Disconnected Record Sets
Posted by Madz at 4/18/2006 12:00:00 AM
Hi,
I am using disconnected ADO record sets while using an Access DB for
storing
my intermediate values in processing. I had initially used a server side
cursor, however it gave a bad performance while inserting a record one at a
time.
Now using a client side cursor gave a decent pe... more >>
SP return status
Posted by mm at 4/18/2006 12:00:00 AM
hello
Is it possible to select the return status i.e.
declare @rs int
@rs = UPDATE DeliveryTable SET Status = 2
WHERE Status = 2
it would be nice if @rs then would hold the value of changed rows.
thanks
... more >>
|