all groups > sql server programming > may 2007 > threads for monday may 7
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
How to use a User Defined Funtion in an SQL Statement?
Posted by zwieback89 at 5/7/2007 9:47:05 PM
Hi,
I am trying to use the following UDF - Split in an SQL statement.
------------------------------------------------------------------------------
--------------------------------------
CREATE FUNCTION dbo.Split(@String nvarchar(4000), @Delimiter char(1))
RETURNS @Results TABLE (Items nva... more >>
how do I create a from in ADP
Posted by spieters via SQLMonster.com at 5/7/2007 9:42:34 PM
L.S.
This is the first time I'm creating an ADP file. I've connected to the SQL
server and using the source data of an empty sql table, I've created a form.
When opening this form it is totally blank without the possibility to enter
data. What did I do wrong.
Thanks in advance
Stella
... more >>
2005 Express Edition: debugging T-SQL (newbie)
Posted by R.A.M. at 5/7/2007 8:34:26 PM
Is it true that as a user of Express Edition I cannot debug T-SQL code? How
experienced programmers diagnose errors in T-SQL instead of debugging?
Thanks in advance.
/RAM/
... more >>
SQL standalone vb application
Posted by albertos.email NO[at]SPAM gmail.com at 5/7/2007 8:26:53 PM
Hello,
I want to develop an application that will have a standalone SQL
application on a local machine using VB. Basically I would like to
write a program in Visual Studio 2005, use SQL, and when I create the
Install, I would like to have the InstallShield create install the
application and ... more >>
different sort orders in different SQL Servers
Posted by ksrinivas at 5/7/2007 7:39:52 PM
Hi All
I have 2 installations of SQL Servers. Both are the one is
8.00.2039 SP4 Enterprise Edition
And the other is:
8.00.2039 SP4 Developer Edition
The same query when fired on the same DB on the two servers yield
different results (the result set is the same but the sort orders
change)... more >>
adding column to table variable
Posted by Roy Goldhammer at 5/7/2007 7:00:55 PM
Hello there
I've tried this code:
DECLARE @Result table (Field1 varchar(100))
ALTER TABLE @Result
ADD COLUMN Field2 varchar(100)
and it gives me error:
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '@Result'.
Is there a way to add new column to table variable?
... more >>
using directory functions on sql server code
Posted by Roy Goldhammer at 5/7/2007 6:42:59 PM
Hello there
I need functions to get data on my files on the computer. Like Dir() on
visual basic.
What is the names of these functions?
... more >>
Help! Single line view return - Part 2
Posted by B. Chernick at 5/7/2007 5:47:01 PM
Sorry to repeat myself but I need an answer quick. If I may rephrase a
previous append:
Is there anyway to do a pivot within a view within SQL Server 2000? (And if
not, does anyone have a handy work-around?)
(I've been reading and trying but it appears that the essential pivot table
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
different behaviour
Posted by Awi Ktir at 5/7/2007 4:32:44 PM
I have table that has many colums.
the ID col is identity and it is the clustered PK
pr_name col has index on it
NPI col has index on it.
MG_id doesn't have index.
the code bellow is behaving differently when uncommenting some of the rows.
shouldn't it use the index on PR_name in every ca... more >>
Alternative to indexed view?
Posted by Dan English at 5/7/2007 4:19:55 PM
I am using a view to include fields from a second table, using a LEFT OUTER
JOIN. Queries are slow when they reference any fields from the 2nd table.
The indexed view seems like a hassle with schemabinding and other rules. Is
there any alternative? Any way to include certain fields from the... more >>
How to script out exec SP listing all parameters in one line
Posted by Nancy Lytle at 5/7/2007 3:40:10 PM
I want to write a script that will generate a script an execute script for
all the stored procedures in my database with the parameters that need to be
entered.
So far I have:
SELECT N'Exec Procedure ' + ROUTINE_TYPE + N' ' +
QUOTENAME(ROUTINE_SCHEMA) + N'.' + QUOTENAME(ROUTINE_NAME) + N' ... more >>
Making a column's values unique
Posted by Andrew Chalk at 5/7/2007 3:38:44 PM
I have an INTEGER column that I want to convert to a primary key. However,
some of the values currently in the dataset are not unique. What query will
delete any records with duplicate values of the intended index?
Many thanks!
... more >>
Log Ship Truncation
Posted by CLM at 5/7/2007 1:39:03 PM
I accidently truncated the log of a production database (on the source
server) that is log shipped. Will Sql Server 2000 self-heal? Or do I need
to tear down and re-do log shipping?... more >>
Encryption question
Posted by Robert Dufour at 5/7/2007 12:00:07 PM
I took a look at a lot of the docs the MS put out to encrypt and decrypt
columns and then looked at their database used to secure membership of a web
site to see it in action (aspnet.mdf). I can see that the appropriate fields
are encrypted but nowhere can I see HOW they encrypt the fields. Th... more >>
checking for DBNull value...
Posted by trint at 5/7/2007 11:33:36 AM
How can I check for a null value in one of my columns before binding
to a gridview?
GridView3.DataSource = cmd2.ExecuteReader();
//check for DBNull value here
Thanks,
Trint
... more >>
Advanced SELECT
Posted by Gidon at 5/7/2007 11:26:32 AM
Hi,
I have a multilingual database with the following design:
Cities
CityID [int]
Name [varchar(256)] ("neutral" name of the city)
Cities_Localized
CityID [int]
LCID [int] (Language ID)
Name [varchar(256)] (translated name of the city)
Now ... more >>
CASE not working as expected
Posted by Drew at 5/7/2007 11:07:13 AM
I am trying to edit a current stored procedure I have to add a different
choice for the ORDER BY clause. Here is my original SP,
CREATE PROCEDURE SSNList
@sortOrder VARCHAR(5)
AS
SELECT E.EmpID, EF.StateEmpID, E.EmpFName, E.EmpLName, EmpMName,
EP.EmpSSN, D.DeptName, EmpStatus
FROM ... more >>
Bulk Insert Related Tables
Posted by Asfar at 5/7/2007 10:58:29 AM
Hi,
I have Table1 with an Id column and this is the primary key for this table.
I have another table, Table2 which has an Id column which is a foreign key
and references the primary key of Table1.
Is there a way to bulk insert rows to both tables?
Also can I use bulk insert if one of the co... more >>
Check executing job.
Posted by Alien2_51 at 5/7/2007 10:26:02 AM
I want to write a query to find an executing job. For instance I have a
maintenance plan that runs weekly occasionaly the job hangs due to various
problems that are out of our control such as network outages, server
maintenance, etc.. Sometimes the operation folks don't talk to the
administr... more >>
Help! Single line view return from multiple records?
Posted by B. Chernick at 5/7/2007 10:08:01 AM
Someone refresh my memory. I am attempting to create a view.
Assuming a conventional one-to-many header/detail relation between 2 tables,
is there a way under sql to display in one line of view return, multiple
records of one field of the detail table, each under a different alias and
ea... more >>
select * frm tbl1 join tbl2 where chars after first 3 dont match?
Posted by Rich at 5/7/2007 8:34:02 AM
Greetings,
I need to select rows from tbl1 join tbl2 on t1.a = t2.a and t1.b =t2.b ...
where the characters after the first 3 in the CompanyID column for tbl1
don't match the characters after the first 3 in the CompanyID column in tbl2.
Here is my pseudocode.
(pseudocode...)
where
sub... more >>
datetime query
Posted by R C at 5/7/2007 8:25:01 AM
hi,
i have a table with an index on a datetime field. i would like to query out
all records with yesterday's date using the index. i did the following:
DECLARE @dt_start VARCHAR(10)
DECLARE @dt_end VARCHAR(10)
SELECT
@dt_start = CONVERT(VARCHAR(10), DATEDIFF(d, -1, GETDATE()), 110),
@dt_... more >>
Programatically checking indexes
Posted by Big Ern at 5/7/2007 8:14:01 AM
Is there a way in which I can programatically check the last time that an
index was rebuilt/reorganized/updated statistics?... more >>
Summing Parents and Children in One Query Without Duplicating Parent Values?
Posted by mjcarrabine at 5/7/2007 7:40:14 AM
I am trying to calculate SUM()s by customer from our order tables;
however, our ERP system has some values only at the line level, i.e.,
quantity, and others only at the header level, i.e., paid to date.
I currently have two queries, one doing the sums at the header level:
SELECT SUM(T0... more >>
Pushing Data into SQL Server programatically
Posted by yoni NO[at]SPAM nobhillsoft.com at 5/7/2007 6:46:08 AM
Hi,
need a general tip: I have an old .net program that pushes data to SQL
Server 2000 using DMO objects (the ImportData method). I need to
convert that to push to SQL 2005 . what are the best options? use SMO
objects? create an SSIS package and use some objects to run it? (which
objects?) shel... more >>
'Query String' in OpenQuery - using quote
Posted by ykffc at 5/7/2007 5:13:01 AM
I am starting to learn writing Stored procedure by reading some examples. I
am stuck when using quotes.
Can someone give me some links to read about how to use them.
An example:
It is so confusing to me when I read a statement such as the following,
where there are so many single quotes.
... more >>
Setting output_file_name for current - executing - job
Posted by Ruben L at 5/7/2007 4:31:00 AM
1.
Is it possible to set the filename for the report genereated for a job step
inside the same job step (like if the report was first generated/Written upon
completion of the step) ?
update msdb..sysjobsteps
Set output_file_name = 'E:\MSSQL\LOG\MyDatabase_' + @BackupDateTime + '.txt'
Where ... more >>
Contains
Posted by Ruby Nadler at 5/7/2007 3:38:01 AM
Hi Everyone,
i am using full text search with spanish sql.
where i am running query with contains and the sign '*' in search i am
getting the error:
Server: Msg 7643, Level 16, State 1, Line 1
Your search generated too many results. Please perform a more specific
search.
i get the error ... more >>
cursors
Posted by Vijay at 5/7/2007 12:18:58 AM
Hello,
I am Migrating one database of Mysql to SQL server 2005, I am facing problem
with Views where in Mysql they have GROUP_Concat (aggregate Function) which
is not available with SQL i found some solution on Google.
1. Use of Cursors (T-SQL)
2. Creating an functions.
but again now i... more >>
Add blank line between different query results
Posted by tony wong at 5/7/2007 12:16:20 AM
how can i add blank line between @query1 and @query2? Thanks.
****************************************
set @query0=@query1 + @query2 + @query3
exec master.dbo.xp_sendmail
@recipients='abc@abc.com',
@subject=@subjecttext,
@query=@query0
... more >>
DB design considerations
Posted by Marcin Kielar at 5/7/2007 12:00:00 AM
I'm facing problem of designing DB, for not really
"relative" data. Let's say there is some kind of object,
which is described by it's primary attributes
(identity data, some core characteristics), and some additional
properties.
The functional requirement is, that user should be able to
ext... more >>
drop procedure
Posted by Hrvoje Voda at 5/7/2007 12:00:00 AM
how to drop(delete) all store procedure from database?
... more >>
Export database
Posted by Alan T at 5/7/2007 12:00:00 AM
Any stored procedure can be used to export the database to a text file?
... more >>
|