|
If you've used the setup migration wizard, everything usually works fine. But in case you used DTS/SSIS, the PK's may not have been replicated and you need to add constraints manually.
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|
parent son
A B
A C
A D
D E
D F
D G
G I
G J
i blank
j blank
b blank
c balnk
I need a query to get son and grandson, grandgrand sons (till Entire generation) …. Of ‘A’…..
|
|
|
|
|
VB.Net Developer wrote: I need a query to get son and grandson, grandgrand sons (till Entire generation) …. Of ‘A’…..
Very good. What have you tried so far? Plus, what database is this query in.
We don't do homework for you, and we don't do your thinking for you. We do help you if you've tried something and can't get it to work.
Hint - if you are using SQL Server, take a look at Common Table Expressions (CTEs) to accomplish this.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Trying to be a bit more helpful
But the solution has to do with CTEs, at least if your using SQL Server as this is not standard SQL:
<br />
with tmp(parent, son) as (<br />
select <br />
tab.parent, tab.son from tab<br />
where <br />
tab.parent='A'<br />
<br />
union all<br />
<br />
select <br />
tmp.super, tab.son<br />
from <br />
tmp join tab on tmp.son=tab.parent<br />
Beware of loops! In that case you need to introduce a recursion counter or a condition that restricts son<>'A'.
|
|
|
|
|
Hi all,
I Have the following statement...
SELECT convert(varchar,convert(varchar,datepart(yyyy,GetDate())) + case Len(datepart(MM, GetDate())) when 2 then convert(varchar,datepart(MM,GetDate()),101) when 1 then '0' + convert(varchar,datepart(MM,GetDate()),101) end + case Len(datepart(MM, GetDate())) when 2 then convert(varchar,datepart(dd, GetDate())) when 1 then '0' + convert(varchar,datepart(dd, GetDate())) end) AS [TodayDate]
Now what i planned this to do is add the leading zero in front of the day and month figure if the length is 1 to make the length 2... like this...
2007110 5 (notice the zero in front of the 5)
BUT it is still showing it like this...
2007115
How do i go about getting the zero in front of the 5 ??? My output needs to look like YYYYMMDD
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Never Mind....
i have made this a bigger problem then it actually is... SORRY about that...
The easiest way to do this is:
CONVERT(CHAR(8), GetDate(), 112)
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
better you can use like...
CONVERT(CHAR(8), GetDate(), 112)
/*101-12/17/2006
102-2006.12.17
103-17/12/2006
104-17.12.2006
105-17-12-2007
106-17 Dec 2006
107-Dec 17, 2006
108-00:00:00
109-Dec 17 2006 12:00:00
110-12-17-2006
111-2006/12/17
112-20061217
113-17 Dec 2006 00:00:00
114-00:00:00:000*/
|
|
|
|
|
Hi,
Problem with converting varchar into Numeric
select DEFINITION_DETAIL_DATA.SMID, Cast(Data_Value as Numeric)as Val from DEFINITION_DETAIL_DATA
inner join DEFINITION_MST on DEFINITION_MST.SMID = DEFINITION_DETAIL_DATA.SMID Where DEFINITION_MST.MPID = 176
and Convert(Numeric,Data_Value) > 10000
Value without where condition shows like.
1 2500
2 3500
3 5000
4 10000
5 15000
6 20000
but when i add Convert(Numeric,Data_Value) > 10000 in query then its give me
an error.
Error converting data type varchar to numeric.
kiran banker
|
|
|
|
|
plz try this
select DEFINITION_DETAIL_DATA.SMID, Cast(Data_Value as Numeric)as Val from DEFINITION_DETAIL_DATA
inner join DEFINITION_MST on DEFINITION_MST.SMID = DEFINITION_DETAIL_DATA.SMID Where DEFINITION_MST.MPID = 176
and val > 10000
|
|
|
|
|
giving an error
invalid column namd
kiran banker
|
|
|
|
|
select DEFINITION_DETAIL_DATA.SMID, Cast(Data_Value as Numeric)as Val from DEFINITION_DETAIL_DATA
inner join DEFINITION_MST on DEFINITION_MST.SMID = DEFINITION_DETAIL_DATA.SMID Where DEFINITION_MST.MPID = 176
and Cast(Data_Value as Numeric)as Val > 10000
|
|
|
|
|
still no working
but i write like this
select DEFINITION_DETAIL_DATA.SMID, Convert(Decimal,Data_Value) as Val from DEFINITION_DETAIL_DATA
inner join DEFINITION_MST on DEFINITION_MST.SMID = DEFINITION_DETAIL_DATA.SMID Where DEFINITION_MST.MPID = 176 AND DEFINITION_DETAIL_DATA.SMID = 204
and Convert(Decimal,Data_Value) > 1
then it works
but i want like this
select DEFINITION_DETAIL_DATA.SMID, Convert(Decimal,Data_Value) as Val from DEFINITION_DETAIL_DATA
inner join DEFINITION_MST on DEFINITION_MST.SMID = DEFINITION_DETAIL_DATA.SMID Where DEFINITION_MST.MPID = 176
and Convert(Decimal,Data_Value) > 1
kiran banker
|
|
|
|
|
Your query is absolutely right. But “Data_Value” column contains invalid data, so this error occurs. Invalid data means column contains the following data:
-Null
-Empty
-Special Characters
-Spaces
Please check the data if contain invalid data then remove & run query, your required result obtained.
|
|
|
|
|
it contains following data.
SMID Data_Value
1 2500
2 3500
3 5000
4 10000
5 15000
6 20000
kiran banker
|
|
|
|
|
HI,
I am doing a project (.net) in which i have added a folder named data and added a ms access database mdb file to it ..........
So when ever i am running my project a copy of data folder is getting stored in the
debug folder and the updates and manipulations which i am doing are getting reflected in the database which is present in the debug folder
and at the time or retrieving data is coming from the data folder which i created
So please tell me a way such that the mdb file must be at a single place
regards
sindhu tiwari
its me sid
|
|
|
|
|
I designed a report in Sql Server 2005 express edition with windows authentication mode and build it. In building no errors. While deploying report it is asking for username & password.
I deployed manually by using URL http://localhost/reportserver
report was deployed but in report viewer in asp.net webform, it is giving error message that Page not found
Prasanna
|
|
|
|
|
need some help here some error appears when i am tryin to run my software
the error is:
"An error has occured while establishing a connection to the server when connection to SQL Server 2005 this failure maybe caused by the fact that under the default setting SQL does not allow remote connections.(provider:Named Pipes provider, error 40-could not open a connection to SQL server)".
|
|
|
|
|
Use SQL Server Service Area Configuration Manager to allow remote connections. Also allow both TCP/IP and Named Pipes protocols. That should solve your problem.
|
|
|
|
|
help plz
where do i find Authonication mode in sql server 2005
coz my configuration is set to windows Authonication and i want to change it into mixed
|
|
|
|
|
Open management studio, right click on the server and properties. Then under security you can change it to mixed mode.
|
|
|
|
|
In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
In the SQL Server Management Studio dialog box, click OK, to acknowledge the need to restart SQL Server.
Make sure you restart the server. and remember "If Windows Authentication mode is selected during installation, the sa login is disabled. If you later change authentication mode to SQL Server and Windows Authentication mode, the sa login remains disabled. To enable the sa login, use the ALTER LOGIN statement."
Cheers
Ghazi
/*
Ghazi Hadi Al Wadi, PMP, ASQ SSGB, DBA
*/
|
|
|
|
|
HI
My Aim is to get the column names of a access database table and store it to a
combobox using C#.net if any one knows the query or any clue please let me know
regards
sindhu tiwari
INNOVATIVE
|
|
|
|
|
string connectionString;
OleDbConnection connection = new OleDbConnection();
OleDbDataAdapter dataAdapter;
DataSet dataSet = new DataSet();
public Form1()
{
InitializeComponent();
}
public void openConnection()
{
try
{
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\\Test.mdb";
connection.ConnectionString = connectionString;
connection.Open();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
public void closeConnection()
{
try
{
if (connection.State != 0)
{
connection.Close();
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
public void fillDataset(string query, DataSet dataSet)
{
openConnection();
dataAdapter = new OleDbDataAdapter(query, connection);
dataAdapter.Fill(dataSet, "ColumnNames");
closeConnection();
}
public void fillComboBox()
{
string strQuery = "Select * From Table1";
fillDataset(strQuery, dataSet);
foreach (DataColumn dataColumn in dataSet.Tables[0].Columns)
{
cmbColumnNames.Items.Add(dataColumn.ColumnName);
}
}
private void Form1_Load(object sender, EventArgs e)
{
fillComboBox();
}
|
|
|
|
|
Why have you posted this question? The link I sent you in response to your previous question also explained how to get a list of fields for an Access table.
You should learn to search Google for answers to your questions before posting. Otherwise it looks like you can't be bothered to search for a solution to your problem yourself.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
you can use the following query in your code ...
SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'name_of_the_table'
Mitesh Darji
|
|
|
|