Is Connect BY Clause Present In SQL Server ?

Feb 16, 2007

Hi,

We need to create a tree stucture output of a query.
In case of Oracle , there is 'CONNECT BY' Clause for creating the same.

Does SQL server support anything of this sort?

If yes, can anybody please provide the syntax for the same?

Regards
Kiran

View 4 Replies


ADVERTISEMENT

Connect By Clause

Feb 4, 2004

Hi,

We have "Connect By Clause" as in Oracle. Do we have the same or equivalent in MS-SQL Server 2000?

Thanks with Regards.

-Mohit

View 3 Replies View Related

SQL Server 2012 :: How To Find Particular Table Is Present In Which Database

Jan 19, 2014

I have created a table but i forget in which database. I know the table name but i dont know the database name..

I have to filter my table from all database ... how can i do and find....

View 5 Replies View Related

SQL Server 2012 :: How To Get Primary Key Value If Not Present In Foreign Key Via Join

May 4, 2014

I've following query which display the result as required, but I need to get the missing Primary Key Values which are not available in the result:

SELECTA.SignedByUserID, B.FullName, COUNT(A.OutletID) AS TotalSignups, DATENAME(Month, A.SignupDate) AS Month
FROMdbo.tblMer_Outlet AS A LEFT OUTER JOIN dbo.tblGen_Users AS B ON A.SignedByUserID = B.UserID
WHERE(A.SignupDate >= '2014-04-01 00:00:00' AND A.SignupDate <= '2014-04-30 23:59:59')
GROUP BY A.SignedByUserID, B.FullName, DATENAME(Month, A.SignupDate)

This Query returns the following result:

SignedByUserID FullName TotalSignups Month
--------------------------------------------------------
9 Babu Raj 16 April
11 Faheem 19 April
39 Fasil Abbas 16 April
29 Hafiz Suleman 10 April

[code]....

which does not have a signup for the month of April, but I need it to be available for this or any upcoming month. I need this orr all users, which does not exists in the context needs to be displayed in the result.

View 9 Replies View Related

Reporting Services :: Data Present When Run On Report Server URL But Not On Regular URL

Nov 10, 2015

Was reported to me that reports were running but data was not being displayed. After checknig the Config manager I found that if I went to the reportserver url then clicked on a report it would diplay he correct data. But when trying it on the normal website it would not display anything.  

sql server 2008 r2
ver: 10.50.2550.0

View 5 Replies View Related

How To Uninstall Server 2008 Express Instance With Other Instances Present

May 15, 2015

This is probably easy for some who have done it, but I have an installed Instance of SQL Server 2008 Express or SQL Server 2008 R2 Express I'll call Instance CCC and need to remove it.  I have two other Express instances I'll call Instance AAA and Instance BBB.  I want to uninstall Instance CCC without affecting the other two instances or the software that uses them.  Instance CCC should have been installed as a SQL Server 2012 Express instance, so I need to remove the 2008 Instance of CCC and reinstall it as 2012.  In all cases, I'm talking about SQL Server Express.  Full SQL Server is not installed.  

The Instances are all installed on a Windows Server 2008 R2 Standard server.   

I have read that I can do this through Control Panel  >  Programs and Features, but that I can corrupt or mess up the other instances (AAA and BBB) if I don't do it right.  I'm uneasy about this, not having done it before, and do not want to affect the users of the AAA and BBB instances!  

View 6 Replies View Related

SQL Server 2012 :: How To Delete Duplicate Rows Present In Parent Table

Oct 19, 2014

I have a master table and i need to import the rows into the parent and child table.

Master table name is Flatfile_Inventory
Parent Table name is INVENTORY
Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
Error details will be goes to LOG_INVENTORY_ERROR

I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.

Again when i run the query using stored procedure,its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.

I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.

-- ===============================================================================================
-- STORED PROCEDURE FOR FLATFILE_INVENTORY
-- ===============================================================================================
USE [IconicMarketing]
---=======================================SALES_CURSUR===========================================
--USE IconicMarketing
--GO
DECLARE
@FileType varchar(50) ,
@ACDealerID varchar(50) ,

[code].....

View 2 Replies View Related

SQL Server 2008 :: Unable To Create Folder If Present Already In A Share Path

Jun 1, 2015

I'm, using my script to many location to create folder to save output files and if the folder is removed/not present it can create it without any noise. But the problem is, while I use the same sort of script to check if a folder is present in the sharedpath it will not create it to copy all bkp files from local to remote path works good, but if you delete the folder or rename the exisitng folder and if the below script tries to create the folder it created as "fILE", very interesting. Per IT team they have given SQL Server account the full rights to create/delete/alter folder/files.

Do I need to use seperate script or way to create / alter folders in the sharepath?

SET NOCOUNT ON
Declare @len INT, @i INT, @Left varchar(max), @right varchar(max), @SERVERNAME sysname,@finalServer sysname
declare @rc int, @dir nvarchar(4000)
DECLARE @cmd1 sysname, @cmd2 sysname, @cmd sysname;
Declare @extPAth varchar(max)

[Code] ....

View 5 Replies View Related

Cannot Connect W/ Java App But Can Connect W/ .Net App - SQL Server Express 2005

Dec 12, 2006

I'm having a problem connecting with a Java application but I CAN connect using my .Net application - the user name and password are the same for both (using the same database on SQL Server Express 2005).

The error I get is: "com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "CORNERS" requested by the login. The login failed." An interesing note - I get the same message if the database is not running.

SQL Server Express 2005 is installed in mixed mode.

Here is my connection string in the .Net appplication: <add key="connectString" value="Server=(local);UID=sa;PWD=myPasswd;Database=CORNERS" />.

These are my values in my Java app web.xml -

<init-param>
<param-name>DBDriver</param-name>
<param-value>com.microsoft.sqlserver.jdbc.SQLServerDriver</param-value>
</init-param>
<init-param>
<param-name>DBURL</param-name> <param-value>jdbc:sqlserver://localhostsqlexpress:1055;databaseName=CORNERS</param-value>
</init-param>
<init-param>
<param-name>DBUser</param-name>
<param-value>sa</param-value>
</init-param>
<init-param>
<param-name>DBPwd</param-name>
<param-value>myPasswd</param-value>
</init-param>.

And yes, the port is 1055 - I checked to find it.

I am using Microsoft SQL Server 2005 JDBC Driver 1.0 (sqljdbc_1.0.809.102).

Does anyone have any idea what is wrong so that the login fails in the Java application but works in the .Net application?

View 7 Replies View Related

SQL Server Express Installed But No SQL Server Express Service Present!?!

Mar 14, 2007

Hi

I'm a newbie and I have a problem that i can't solve despite sitting here all day trying to wortk it out.

I have installed SQL Server Express 2005 along with the associated toolkit. Previous to that i installed MS Visulal studio 2005, .NET 2.0 and MSDN.

The problemn is that it appears despite installing everything i don't have SQLExpress services running on my PC. I have admin rights, it installed okay but there is nothing to connect to.

When i run "sqlcmd.exe -s (local)SQLExpress -E" from the command prompt i get the following message:

HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi
shing a connection to the server. When connecting to SQL Server 2005, this failu
re may be caused by the fact that under the default settings SQL Server does not
allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

When i run SQL Server Configuration there is no "SQLExpress" service present under "SQL Server 2005 Servcies" in SQL Server Configuration dialog; just a message saying:

"there are no items to show in this view"

When i run Surface Area Configuration i get the following message:


TITLE: Surface Area Configuration
------------------------------

No SQL Server 2005 components were found on the specified computer. Either no components are installed, or you are not an administrator on this computer. (SQLSAC)

------------------------------
BUTTONS:

OK
------------------------------


If you can shed any light on this id be extreamly grateful as i'd been here for hours before stumbling across the toolkit (why this wasn't bundled i don't know) only to realise once i had it that the SQLExpress service isn't running :(

Cheers,

Nick.



View 1 Replies View Related

How To Insert A Row Only If It's Not Present

Apr 16, 2008

Hi,

I've been asked to find a way to insert a row only if it's not present. I want to make sure that test and insert are atomic, so I wrote the following test cases


-- CREATE TABLE t1 ( id int, val varchar(256) )

-- GO


-- Execute the following statements in one query window

IF NOT EXISTS(SELECT * FROM t3 WHERE id = 1)

BEGIN


WAITFOR DELAY '00:00:10'

INSERT INTO t3(id, val) VALUES (1, 'Query 1')

END

GO


-- Then execute the following statements in a second query window within ten

-- seconds of the starting the first query

IF NOT EXISTS(SELECT * FROM t3 WHERE id = 1)

BEGIN


WAITFOR DELAY '00:00:10'

INSERT INTO t3(id, val) VALUES (1, 'Query 2')

END

GO


When both queries are complete there will be two rows in the table t with id = 1.

1 Query 2
1 Query 1

Wrapping the code in a transaction does not change the result. Changing the transaction isolation level to serialable causes a deadlock, but otherwise the isolation level has no effect on the result either. Adding a WITH (TABLOCK) hint to the tests do not change the result.

Our clients use a mix of SQL 2000 and SQL 2005 so TRY/CATCH blocks cannot be used.

Any suggestion on how to do this?

Thanks

View 11 Replies View Related

The Given Key Was Not Present In The Dictionary

Feb 4, 2008



I'm developing a report which contains a number of matrixes which are ordered in a hierarchy which can be navigated using a document map. One of the matrixes contains a subreport containing a table which displays a description for the matrix and the corresponding document map label. This is working without problem already in the production environment.

Recently, after updating my machine with numerous updates and patches, this stopped functioning. I now receive the error message, "The given key was not present in the dictionary" when I run this subreport, either as part of the greater report or on its own.

I have seen the posting which recommends deleting the report.rdl.data files. This did not solve the issue.

The data and the dataset are both in sync. When I click the "Print layout" button when previewing the report in Visual Studio .Net 2005, I can view the data. This looks like a bug in the VS.NET 2005 report designer.

I am running SQL Server 2005 SP2.

Any help is appreciated.

Regards,
Bill Mueller

View 3 Replies View Related

Not Present On The Subscriber.

Dec 11, 2006

Hi all,

Publisher
SQL 2000 Snapshot publication timed to run at 23:00 daily All tables & views are published articles.Snapshot agent runs and creates a snapshot of all articles.

Subscriber
SQL 2005 Pull subscription set to run continuously Manually run the SQL agent job and I get the following error... 2006-12-11 15:04:35.687 Agent message code 20164. Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber.

I've tried creating the subscription database from a backup so I know all the tables & views exist and also tried just creating a blank empty database - same error.

There are no user stored procedures or functions in the database.

If I'm publishing all tables & views then why should the data & structure fail to load at the subscriber? Do I need two publications, the first containing the metadata and the second containing the data?

Thanks in advance
Dave

View 6 Replies View Related

Transact SQL :: How To Create UNION Clause With Two Queries That BOTH Have WHERE Clause

Nov 4, 2015

I have a quite big SQL query which would be nice to be used using UNION betweern two Select and Where clauses. I noticed that if both Select clauses have Where part between UNION other is ignored. How can I prevent this?

I found a article in StackOverflow saying that if UNION has e.g. two Selects with Where conditions other one will not work. [URL] ....

I have installed SQL Server 2014 and I tried to use tricks mentioned in StackOverflow's article but couldn't succeeded.

Any example how to write two Selects with own Where clauses and those Selects are joined with UNION?

View 13 Replies View Related

Effectively Getting Data And Present It By Location

Jun 16, 2008

Hello. I have been challanged to build an application that keeps track of inventory and dates of every item that needs inspection on regular intervals. The original application was a .NET windows application and i have been tasked to "port" and improve it to a .NET C# web application.
The original database was in access and i have imported everyting to SQL and all the data is in a single table. So far the table is relatively small so i decided to keep the current database design.
What i need to do is to select all the items that are comming up for inspection in the comming months and present them. Each item has a uniqe article number (artnr) with the item name, category and location of the item. The location is the part i would like each items to be presented by. Basicly i would like to retrive artnr, name, type and present x number of gridviews or a sorted presentation where each item is shown inside each gw/whatever by location.
I also considered moving all locations to it's own table and connect it with a PK/FK to the prinmary article table but i dont know if this will help me or not. Basicly i have no idea how i would present the items by location where each gridview/somethign else is it's own location.
I could really use som help with how i can retrive and present the data so it is showed in the above manner.

View 1 Replies View Related

Cascade Deletions Of Children When FKs Present

Dec 8, 1999

Guys, could anyone tell me if MSSQL Server 7 has 'on delete cascade' option when creating a foreign key constraint or something similar to it. I'd really like MSSQL to remove all dependent records (child records) automatically from one table when I'm deleting a parent record from another record. I know that I can do it via trigger, but the FK constraint should be removed or disabled. I would really appreciate your help. Thank you very much.

View 1 Replies View Related

Selecting The Records In The Present Week

Dec 3, 2007

Dear All,

I want to retrive the records if are created in a particular week.
if i pass 03/12/2007 , i want get records which are created in that week

View 11 Replies View Related

How To Present Time Series Chart On The Web

May 28, 2006

Help me!!

1. Can you tell me the way to present Time Series Chart on The Web by ASP.Net 2.0
2. I have a Time Series Mining Model. Its structure is:

(Month datetime key time, Sales continous predict)

When the query runs:


select Flattened  Predict(sales,5)

from Model_Name
The result is Month and sales in the future. But i wan also retrieve Month and Sales in the past . Tell me the way?????

Thank alots!!!!!!!

View 4 Replies View Related

Retrieve All The Filename Present In One Particular Location In SQL

Dec 20, 2007



Hi,

I need to read all the text files present in one particular folder and have to place all the contents in the file into a table. I will be knowing the location of the file but i will not be knowing the name of the file. I am using a BULK INSERT command to place all the contents to a table.
Eg: BULK INSERT TEST FROM '\BSSC018C$IP Office LogsLog 20071206 000000 (5).txt'
To use BULK INSERT i have to specify the location of the file with the filename. So can anyone please help me to know how the names of the file can be fetched through SQL query. If i am able to get all the file names i can use a cursor and insert all the datas from all the text files.

Thank you.

View 18 Replies View Related

Reporting Services :: The Given Key Was Not Present In The Dictionary

Jul 5, 2006

When I try to preview a SSRS report in VS 2005 I get the following error: "The given key was not present in the dictionary", however when I deploy the report and view it in the Report Manager all is fine. I have not been able to find any useful info in MSDN, what I can try?

View 8 Replies View Related

Checking Whether Particular Field Present In The Result Set

Jul 17, 2007

Hi,

I have one dymic report and one of the requirement is that,I want to check whether particular field is present there or not



For e.g In one of the case Fields!Name will come and in other case it won't.

There one dynmic column which calculated values based on all the column.



If I write in value field of this column as follows.[If status = "Name" and Field is not missing then take Name value,if field name is Consumer take value from Consumer and shows it in column.]



=Switch(Fields!portfolio_status.Value="Name",IIF(Fields!IName.IsMissing,"0",Fields!Name.Value)

,Fields!portfolio_status.Value="Consumer",IIF(Fields!Consumer.IsMissing,"0",Fields!Consumer.Value))





In case,portfolio_status doesn't give me value "consumer" then I expect "0" to get printed.Problem here is that IIF expression tries to evaluate Fields!Consumer.Value even if it is not using this value and because of that my calculated column is not working.

I tried IsMissing,IsNothing..Nothing seems work.Basically I want to check if that field is there in result set or not.



IIF(IsNothing(Fields!Consumer),"0",Fields!Consumer.Value)

IIF(Fields!Consumer.Value Is Nothing,"0",Fields!Consumer.Value)

View 1 Replies View Related

RMO ERROR : No Signature Was Present In The Subject.

Jun 7, 2007

Hi !

I have such a message after trying to do replication with SQL Server 2005 using custom Business Logic Handler for a Merge Article (RMO Programming).

Message Replication-Replication Merge Subsystem: agent 'job' failed. No signature was present in the subject.

I am using C# with RMO, merge replication.

Any ideas ? How to solve this problem ?

Thanks.

View 2 Replies View Related

Can't Login Remotely Even Though Membership Data Is Present

Dec 18, 2006

(Sorry this was posted to VWD2005 Express by mistake)
I have created a simple project using ASP.NET 2.0 which enables a user to login. I created the login user using the Web Administration Tool in Visual Studio 2005.
I created everything locally and it worked.
Locally I have 2 databases. One containing normal data (which my site uses to populate a GridView control) and the other being ASPNETDB.MDF - which contains membership (login user) data. These 2 databases sit in the App_Data folder which is in the root of the project.
I have a remote database which is hosted in a shared environment.
This is just the one database and it appears to have all tables in the one database (membership tables and normal tables - such as the one I use to populate my GridView control).
I uploaded the website and using the Database Publishing Wizard I uploaded the database data to the shared host. I also changed the connection string to point to my remote database.
If I visit the website the GridView is populating correctly (pulling data from the remote database) but when I try to login it crashes. The error is "Access denied creating App_Data sub directory".
The membership login details for the user I created are in the remote database as I have compared the data in it to the data in my ASPNETDB.MDF local database.
If I launch from within Visual Studio 2005 then it allows me to login perfectly well.
Please does anybody know why it won't let me login when I access it via the website?
Many thanks for any help,
Graham

View 3 Replies View Related

How Check Either One Name Of The User Is Present Or Not In Data Table From C#.net

Jan 31, 2008

hi
 can anyone help me out, i have one issue that is how i have to check while adding new user details to database table weather that user name is exist in that table or not.
for my application i'm using oracle database and C#.Net.
table is g_users and columns are:
 Name                                      Null?    Type ----------------------------------------- -------- ---------------------------- USERID                                    NOT NULL VARCHAR2(5) NAME                                               VARCHAR2(20) EMPID                                              VARCHAR2(5) USERNAME                                  NOT NULL VARCHAR2(30) MOBILE                                             NUMBER(12) EMAILID                                            VARCHAR2(20) DOMAIN                                    NOT NULL VARCHAR2(30)
i need to check from c# programming before inserting a new row into table weather username is already exists are not. how to check this one?

View 5 Replies View Related

Invalid Attempt To Read When No Data Is Present.

Apr 23, 2008

I'm writing my first .net app in VB.net.  I can connect to my database, but get the following error when I try to set a label value.  (My code is listed below)  What am I missing? 
Exception Details: System.InvalidOperationException: Invalid attempt to read when no data is present.Source Error:



Line 19:
Line 20: reader = comm.ExecuteReader()
Line 21: EmployeesLabel.Text = reader.Item("tkinit")
Line 22:
Line 23: reader.Close()
 <%@ Page Language="VB" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim conn As SqlConnectionDim comm As SqlCommand
Dim reader As SqlDataReaderDim connectionString As String = ConfigurationManager.ConnectionStrings("IntegratedDataConnectionString").ConnectionString
 conn = New SqlConnection(connectionString)
 comm = New SqlCommand("Select top 1 tkinit from tEliteTimeKeep", conn)
conn.Open()
 
reader = comm.ExecuteReader()EmployeesLabel.Text = reader.Item("tkinit")
 
reader.Close()
conn.Close()
 End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"><title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
 
<asp:Label ID="EmployeesLabel" runat="server" ></asp:Label>
 
</div></form>
</body>
</html>

View 3 Replies View Related

Invalid Attempt To Read When No Data Is Present.

May 16, 2008

My query actually returns rows but when I run, I get this error "Invalid attempt to read when no data is present". It says that the datareader does not return any rows.
Please help.
Thanks in advance
Sangita

View 5 Replies View Related

How To Present An Unknown Number Of Columns And Their Names

Aug 14, 2001

I've got a database with an unknown number of columns. Hence, the column names are also unknown. What's the easiest SQL to present the values in each column and the column headings?

View 1 Replies View Related

Delete Records In SQL Table, Which Are Present In Excel

May 5, 2006

Hi everyone,

I have a task to create a dts package, which will delete records in a SQL table, which are present on a sheet tab in Excel. I know how to transfer records from Excel to SQL table and vice versa, but not sure how I can delete the records in SQL table, which are present in Excel. Note that there are just 2 columns - one is a key and the other name.

Thank you all in advance,
Saurav

View 1 Replies View Related

Join Between Two Tables Where Asset Tags Are Present

Dec 20, 2012

There are two tables A and B where asset tags are present, but in one table in rows and in another in column wise.

for eg
ASSet Tag
SR-062009-00032966
SR-062009-00032962
SR-072009-00020572
SR-072009-00020571
SR-072009-00020585
HH-092009-00038342

Table B
field 1 -->Asset TAG
Record 1-->SR-072009-00020572,SR-072009-00020571,SR-062009-00020685,SR-072009-00001592,SR-072009-00001376,SR-062009-00020683,SR-092009-00001617

field 2 --> Material code
REcord 1-->121
REcord 2-->123

What is the query so that asset tag of A matches with each and every asset tag table of B and output comes as

Output
Asset TAg -------- MAterial Code
SR-062009-00032966
SR-062009-00032962
SR-072009-00020572 ------121
SR-072009-00020571 -------121
SR-072009-00020585

View 5 Replies View Related

T-SQL (SS2K8) :: Query Result To String And Present In New Row?

Oct 21, 2015

I have made following code:

I want to make a string from "TarLang.AppendText(String.Format("{1}" & vbCrLf, r("Source Language"), r("Target Language")))" and the result I get when I use that.

add the result into a new row in the datagridview

Dim CompanyID As String
CompanyID = OrderNR.SelectedItem.ToString()
SQL.ExecQuery(String.Format("SELECT snSrc.kod as 'Source Language', snTrg.kod as 'Target Language' FROM [teknotrans_dev].dbo.OpusOrderrow as ord INNER JOIN [teknotrans_dev].dbo.OrderVolvoLanguageName as snSrc

[code].....

View 2 Replies View Related

Invalid Attempt To Read When No Data Is Present

Nov 1, 2006

I have a stored procedure that inserts a record, and then either returns an error or, when successful, returns the entire row. This is a method I use on sites I have developed in other languages when inserting or updating data; I am new to c#.

With C# I have a datareader executing the sp, and the insert works fine, however I get the error "Invalid attempt to read when no data is present." when I try to read the data that should be coming back. I have researched and updated my code so that I no longer get the error, but I still cannot get the data back. I trap the sp in profiler, ran it in anaylzer, and it works fine - data is returned. But in the code, it does not see the data.

I have modified the return results so now I just have the ID coming back and that works fine. But I would rather just return the entire row. Can this be done, and if so, how?

Thanks.

View 3 Replies View Related

Do Nto Send Scheduled Report When No Data Is Present

Jan 2, 2007

Dear Friends:

Could somebody please help me to stop sending scheduled report when no data is present in the report? Actually I have a daily report which is sent to the client and in a week, two or three days, data will not be there and thus it delivers blank report to the client.

So how can I stop sending blank mails to the client?

Thanks in Advance

Emmanuel Mathew

View 1 Replies View Related

Invalid Attempt To Read When No Data Is Present

Jul 25, 2007

I am using a standard dbreader type of loop in a query to retrieve data. I am running over what should be end of record set, every time.



I have altered my read procedures to use while dbreader.read() and if dbreader.read(), to attempt to avoid getting the error. Neither is stopping it.



While debugging it, as I get to the last item and actually get the error, if I check the dbreader status, it still indicates that it has rows.



Anyone have any ideas on how to get around this?



TIA, Tom

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved