T-SQL Questions and Answers

Recent IT Questions

21 - 40 of 59

How to enable a trace for SQL Server Analysis Services using T-SQL?

Hi I want to enable a trace on analysis services Filter only the errors and notifications log them in a table and send a mail. I am right now doing using sql profiler, but i dont want to do this using profiler as i have to log on the server continuously. I need to do this in T-sql like an SP or a...

Answer Question   |  Dec 2 2008  9:27 AM GMT
T-SQL, SQL Server administration, SQL Server 2005
asked by GIG

  240 pts.

How to generate a column name in a table dynamically

hi, I have to generate dynamic columns for a temp table. I have a temp table with column a, the column b should be generated based on a condition. B conditions are if value> 10 i have to genrate the column as 10 and if the value >20 the column name should be 20 etc....n values.... If i...

View Answer   |  Oct 14 2008  3:59 PM GMT
T-SQL, SQL Server 2005, Dynamic SQL
asked by GIG

  240 pts.

T-SQL Query- how to explode XML fragment stored as NText into table?

I'm using a commercial storefront software that offers "extension data" fields as NText to store custom data. I am storing an xml fragment that looks like this: <priceSplit xmlns="http://tempuri.org/priceSplit.xsd"> <split> <type>Credit Processing Fee</type> ...

View Answer   |  Sep 25 2008  8:03 PM GMT
T-SQL, XML, Query
asked by Lambrite

  5 pts.

CASE sintaxis error in SELECT

In the middle of a large storage procedure I have a working SELECT 01 (see below) which at a couple of points uses CASE statement. I need to expand the most inner CASE to get SQL Server check for several values instead of one. Currently CASE I am talking about looks like (it is in the middle of...

View Answer   |  Jul 18 2008  7:46 PM GMT
T-SQL, SQL Server 2005, CASE statement
asked by Jzurbo77

  5 pts.

Concatenate Two Fields t-sql

I need to concatenate two fields one varchar(50) and the other varchar(12) The result I need is to see the full 50 characters of the first field even though all 50 may not be filled. Thanks

View Answer   |  Jun 25 2008  3:41 PM GMT
T-SQL, SQL Server, Concatenate
asked by Jp5282

  5 pts.

Problem converting Access SQL query to T-SQL 2005

I have a SQL Server 2005 database. One of my co-workers has put a MS Access front-end on it, because of the ease of designing queries in Access. I need to convert an existing query from Access SQL to T-SQL to put it into production. So far, I have removed all the obvious differences between the 2,...

View Answer   |  Jun 3 2008  3:41 PM GMT
SQL, T-SQL, Microsoft Access
asked by Chunkydrew

  15 pts.

help with t-sql recursion

I have a table CREATE TABLE [dbo].[chart_hiera2]( [int] NULL, [ChildID] [int] NULL, [Child] [varchar](100) NULL, [ParentID] [int] NULL, [CGID] [int] NULL, [Depth] [smallint] NULL, [Lineage] [varchar](255) NULL, [node] [bit] NULL, [PercentOwnership] [varchar](10) NULL, [Notes]...

Answer Question   |  Mar 28 2008  8:32 PM GMT
T-SQL, Recursion
asked by Ilay

  5 pts.

Using Case Statement Inside SQL Join

Hi, I am trying to convert dynamic sql into static sql due to permission issue, I faced a challange when i am trying to convert this part of code given below -- join to ADDR_DETAIL SET @join_sql = 'inner join ADDR_DETAIL on ADDR_DETAIL.GRP_CONTACT_ID = pm.GRP_CONTACT_ID AND ' IF...

View Answer   |  Mar 13 2008  11:08 AM GMT
SQL, T-SQL, JOIN statement
asked by Bmdayal

  5 pts.

Passing a database name as a stored procedure parameter

I would like to be able to pass the name of a database as a parameter to a stored procedure. This db would be used for certain queries and may be different from the db where the stored procedure runs. Is it possible to specify a database name from within the T-SQL of the stored procedure? If so,...

View Answer   |  Mar 11 2008  10:13 PM GMT
T-SQL, Stored Procedures
asked by SQL Server Ask the Experts

  2445 pts.

issue sp_helprotect

if i give sp_helprotect on one table. it shows the list of access few tables permissions including given table. can i know why it is happens

View Answer   |  Mar 5 2008  3:01 AM GMT
T-SQL, sp_helprotect
asked by Sqlhnd

  30 pts.

SQL Server Connection

I'm having a problem with one of my workstation which cannot connect to SQL server instance, while the other workstation can connect. The server is running on Window Server 2003 while the other client are running on window xp proffessinal. the fanny thing is i can ping the server but the...

View Answer   |  Feb 18 2008  8:33 AM GMT
Windows Server 2003, Windows XP, T-SQL
asked by Gmmurage

  5 pts.

SQL Command

I have created a stored procedure in SQL2000 like this : SELECT p.PO_code,p.Po_date, p.Supp_code + ' : '+ s.Sname as Supp_Nme,p.po_total,r.RC_code,r.Amount FROM PO_list p inner join RC_list r on r.PO_code = p.PO_code inner join Supplier s on s.supp_code = p.supp_code WHERE...

View Answer   |  Jan 31 2008  3:09 AM GMT
T-SQL, SQL Server 2000, Stored Procedures
asked by 2830360

  50 pts.

view and temp. table which one works better in T-SQL?

please tell me which one performs better view or temp table ?

View Answer   |  Jan 5 2008  0:13 AM GMT
T-SQL, Oracle Views, Temp Tables
asked by HL

  5 pts.

case when issue

I recently came across behavior of a "case when" conditional expression that really confuses me. In this case: -- CASE when isnumeric('-10.00%') > 0 then convert(numeric, '-10.00%') end ---- the behavior is as I expected - the isnumeric() function returns 0 (cuz it ain't no number) so the...

View Answer   |  Nov 17 2007  1:39 AM GMT
T-SQL, SQL Server, case when expression
asked by Zhoover

  5 pts.

Using Local Variable as FILENAME in CREATE DATABASE Statement

I am trying to use this statement in SQL Server 2000 :- CREATE DATABASE [Maintenance] ON (NAME = N'Maintenance', FILENAME = @TableName , SIZE = 2, FILEGROWTH = 10%) LOG ON (NAME = N'Maintenance_log', FILENAME = @LogFileName , SIZE = 1, FILEGROWTH = 10%) COLLATE Latin1_General_CI_AS GO ...

View Answer   |  May 22 2007  7:23 AM GMT
SQL, T-SQL
asked by TheHutt

  0 pts.

Count Distinct Rows on Multiple Columns

I want to write a single query that counts each distinct Student ID from the following sample data. Sample Data: ID NAME PLAN DESCR --- ------- ---- ------------------- 101 Michael 010C Cafe- 10.00 Dollars 102 Adam 010C Cafe- 10.00 Dollars 102 Adam 05CC Cafe- 5.00 Dollars 103 Jane ...

View Answer   |  Jan 5 2007  8:23 PM GMT
Windows, Programming Languages, Security
asked by mjackson

  0 pts.

iSeries accessibility to VB.NET, ASP 2.0/3.0 ,NET programmers in Visual Studio

My shop does not have WebSphere but does have a sizeable VB.NET team using the MS Visual Studio. They need access to the iSeries files in DB2/UDB - real-time. We already thanks to me have a number of batch/DTS package type transfers. Do any of you know packages that can make the iSeries files...

View Answer   |  Dec 27 2006  10:35 AM GMT
Security, Oracle, PC/Windows Connectivity
asked by JohndeCoville

  0 pts.

Sending Table Data From Oracle 9i To Sql Server 2005 using oracle 9i Trigger

My aim is to send the data from oracle to sql server 2005 whenever there is data insertion, deletion or updation in the oracle table the same change needs to happen in the sql server having the same table structure as oracle.But I am not finding any way to accomplish this task.please help me. Have...

View Answer   |  Nov 14 2006  5:01 AM GMT
Visual Basic, SQL, T-SQL
asked by dhirendra10

  0 pts.

Problem finding a column name.

The following SQL is giving me the message: Server: Msg 207, Level 16, State 3, Line 1 Invalid column name 'ProductCode'. How can I correct this code. The column name does exist in the table. I also want to group by Product Code and not by Container Name. Thank you. SELECT a.ProductCode AS...

View Answer   |  Aug 15 2006  3:58 PM GMT
SQL, T-SQL
asked by captnskirk

  0 pts.

Error tracing using triggers

I'm running an application, using a SQL Server 2000. At some point we've implemented an error, that seems to cause the wrong data to be deleted from a table. We've tried locating the error both by browsing through the potential code likely to contain then error, and by logging different kinds of...

View Answer   |  Nov 28 2005  9:38 AM GMT
SQL, Software Quality Assurance, T-SQL
asked by LeChuck

  0 pts.

21 - 40 of 59