|
Hi,
The first example is what is called a "user defined function".
This is a means for SQL to process data based on parameters passed to the function and then return a value(or a table).
In this case the function takes an object and object type as input.
The object type, in the bottom piece of code, is "u" which means that the function only looks for tables.
The advantage of a function is that you can create this code once and reuse it many times by just calling it with dbo.DoesObjectExist('tablename','u').
In terms of creating a SQL table in C++ I'm sorry to say that I cannot help you with that yet as I am learning C# at the moment.
What I can recommend is google and searches with strings such as "create SQL table with C++" and "SQL create table".
As a tool google is invaluable and has proved to be just this in my work - as there is always going to be an example somewhere out there of what you are trying to do.
Good luck.
You always pass failure on the way to success.
|
|
|
|
|
hi every body
i have my project that i have pages that contains grid views then with updating sume page the underlining under page number became hidden and some pages still underline under page number visible what happend and how i can make the pages page underlines visible thx in advance.
let's work together
|
|
|
|
|
how to find the last value in a Table .
My table was designed by another person ..it doesnt have any Identity column ..
It has only EMPname,Empaddress,EmpContactno.
can any one pls tell me how to find the last value in the table
Thanks in advance
Regards
Bino varghese
|
|
|
|
|
you mean to say u want a last record of the Table...is that so...
|
|
|
|
|
if i m getting you correct so let me tell you there is no such way by which u can get the last row of the tabe u shuld be more specific abut ur query..but there is a way by which u can achieve ur task.
select top 1 * from table
order by somefield
Hope it will work for you.
Thanks and regards
Aavesh Agaerwal
|
|
|
|
|
Last value by what criteria?
|
|
|
|
|
Not sure why you need this bug:
SELECT TOP 1 X
FROM TABLE
ORDER BY X DESC
|
|
|
|
|
hi all
Thanks for ur reply..
If I order by I vl not get the last value in the table..
I want the last record in the table .
|
|
|
|
|
One of the fundamental principles of a relational database is that the physical order of rows and columns in the tuples (tables) is not important.
http://en.wikipedia.org/wiki/Relational_database[^]
If you need to extract data in a particular order, the data itself should provide the means of doing this. For instance, if you had an numeric EmployeeID field which was incremented every time a new employee joined the company then you could find the last value in your table by selecting the row of data with the highest EmployeeID value. You don't have any data items that you can use for this purpose in your table so you can't achieve this.
Paul Marfleet
|
|
|
|
|
Suppose if i have 4 After triggers and i want to give the order for them in which they fired i can do that with the help of sp_setordertrigger but with this i can only specify which one can be fired first and last one but what abut the rest of triggers how can i order them..please help me..in this i m new for trigger...
Sucess need one master Stroke
Thanks and Regards
Aavesh Agarwal
|
|
|
|
|
How can we swap the values of the Two columns..using query
is it possible or not if it is then how?
Please let me know the query.......
-- modified at 5:26 Wednesday 10th October, 2007
|
|
|
|
|
Aavesh Agarwal wrote: swap the values of the Two columns
Assuming that both the columns are of the same data type
update yourtable set columnA = columnB, columnB = columnA
|
|
|
|
|
thanks for ur reply..its working but logically how it happens in sqlserver..by using a=b or b=a ..it will not give the same values in the both the columns...
|
|
|
|
|
hi this is ajay rathi,
i am facing a very big problem,
select month(Start_date) as start_Month, year(Start_date) as start_Year,
sum(case when Status = 'Active' then 1
else 0 end) as Active,
sum(case when Status = 'Inactive' then 1
else 0 end) as Billed
from tbl_Post_Job where Company_Id_Fk = 60 and Start_date between Start_date and Exp_date group by year(Start_date), month(Start_date)order by year(Start_date), month(Start_date)
in this query i want many things,first of all i want to say this is not right query i want query from you..
(1)month(Start_date) as start_Month, year(Start_date) as start_Year
from this line i want month and year from Start_date to Exp_date
(2)in active condition,if any company's status is active from january to april so in this condition the entry of active should be come in january to april in every month
(3)group by year(Start_date), month(Start_date)
in group by section same problem,i want data from Start_date to exp_date
actually the main problem i m facing is this that when i need month and year together and active postion and billed position saperatlly..
actually i need this data in following form...
Date | Active | Billed
------------------------------------
january,2007 | 4 | 2
feburary,2007 | 7 | 5
march,2007 | 4 | 2
april,2007 | 6 | 4
------------------------------------
january,2007 is the start_date and april,2007 is the exp_date
actualy above data january,2007 is coming in form of 1,2007 but i need this data in form of january,2007 so plz tell me how can i convert this data...
plz if any one needs any clarification then plz ask me about this because i need this query immediatly..
plz try to help me as soon as posible
Ajay Rathi
software engineer
NOIDA(UP),INDIA
|
|
|
|
|
hi Ajay
Actually i didn't undestand your Qn...
but using the below qry u will get the name of the month..
select datename(month,month(start_date)) from <tablename>
Regards
Joe
|
|
|
|
|
you gave me solution of one problem "datename(month,month(start_date))"
but this is giving me again and again only "january" nothing else..
so plz give me the other solution..
and wht you could not under stand in my first problem plz tell me....
i need the solution...
plzzzzzzzz
Ajay Rathi
software engineer
NOIDA(UP),INDIA
|
|
|
|
|
Arihant rathi wrote: plzzzzzzzz
Enough with the textspeak please. It's really annoying.
If you want to get the year/month description, concatenate the result of datename(month,month(start_date)) and year(start_date) .
Paul Marfleet
|
|
|
|
|
sorry for the wrong Qry
correct one is
select DATENAME(month, start_date) from <tablename>
|
|
|
|
|
hi,
I am using MySql .NET Connector 5.1.2.
Following is the code I am using to read a longblob field from a table..
string selCmd = "SELECT * FROM document";<br />
MySqlCommand allDocsCmd = new MySqlCommand(selCmd, con);<br />
MySqlDataReader reader = allDocsCmd.ExecuteReader();<br />
reader.Close();
The execution hangs at reader.Close();
When I selected everything else but the blob field from the table and it worked fine i.e.
"select id,data from document" hangs but
"select id from document" works ok.
('data' is a LONGBLOB field in document table)
I am searching a cause and fix but lemme know if anyone has ne idea why this is happening..
Thanx.
-- modified at 9:56 Wednesday 10th October, 2007
|
|
|
|
|
hi!1
Actually i am a beginner with asp.net and databases .
i want to know that how can i access values from a table where some column name has null value say parentId ..
Mrinal
|
|
|
|
|
what if one value is int type and the other is null type
Mrinal
|
|
|
|
|
SqlDataReader r =//..some code..
int ParentId;
//short form
r.IsDBNull(r.GetOrdinal("ParentId"))?-1:Convert.ToInt32(r["ParentId"]);
OR
int ParentId = -1;
if (!r.IsDbNull(r.GetOrdinal("ParentId")))
{
ParentId = Convert.ToInt32(r["ParentId"]);
}
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
SELECT AField FROM ATable WHERE parentId is null
|
|
|
|
|
Hi,
I have a simple doubt.The maximum number of parameters in a stored procedure is 2100.
Like what is the maximum number of stored procedure in a MSSQL database ????
Be very grateful for any advice.
Regards
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Vipin dev wrote: The maximum number of parameters in a stored procedure is 2100.
I find that would be hard to reach that number.
Have you looked around google for your question about the max. number of stored procs?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|