Is There A MSSQL Equivalent To Mysql_num_rows()?

Mar 12, 2004

Hi there,
I am trying to find an equivalent to the MySQL function mysql_num_rows() that returns the number of rows returned in a result set.

I only found COUNT, but that doesnt work...

I am working on a web authentication system. The User enters UN and PW, which is then checked with the DB.

<?PHP
//connect to the mssql server
xxx
//select the database to use
xxx
// query
$query = "SELECT * from $table WHERE username='$username' AND pwd='$pwd'";
$result=@mssql_query ($query);

$bla=COUNT($result);
echo $bla; // just to see if it works
if ($bla=1)
{
echo ("welcome $username");
}
elseif ($bla!=1)
{
echo ("auth required");
}

?>

$bla always returns 1... regardless of the UN and PW have been entered and whether they match an entry in the DB

Any thoughts?

cheers.

View 3 Replies


ADVERTISEMENT

Equivalent Of UTL_FILE Of Oracle In MSSQL

Apr 25, 2008

Hi all,

I am currently migrating my database from oracle to MSSQL. My problem is that i have encountered the UTL_FILE function in Oracle and i am not finding its equivalent for MSSQL.

Can anyone help me with this plz? Is there any other way of reading and writting OS files in MSSQL?

Regards
Dhiraj
Software Engineer.

View 3 Replies View Related

Mssql Equivalent Of Mysql Merge Storage Engine

May 13, 2008

Hi,

Mysql database provides a storage engine called "MERGE".A "MERGE" table is a collection of identical tables that can be used as one.(Identical meaning same column name,column width, column order etc.) .

The advantage is you can split a really huge table like LOG tables, STATS tables into seperate smaller tables but would still be able to make queries on them like a single table. More details, can be got from here:

http://dev.mysql.com/doc/refman/4.1/en/merge-storage-engine.html

My question is that do we have an equivalent of MYSQL "MERGE" in MSSQL ????

Thanks,
:)

View 2 Replies View Related

How Many Result-rows Does Mssql Return Should Be Used Asynchronous Method To Use Mssql Cursor?

Aug 11, 2004

How many result-rows does mssql return should be used asynchronous method to use mssql cursor, can get the best performance in any time in any result offset?

i want to make the cursor fast in any time whatever how many results returned

View 2 Replies View Related

Database Migration Plan - (mssql/msde To -&> Pgsql/mssql)

Feb 10, 2008

Hi,

i was planning to create a database migration tool ..
its a certain database of a DMS (document management system) to
another DMS (two different DMS)... from DMS using msde 2000 server .. and tranfer to a DMS using a postgre sql or mssql .. depends ..

they have different table structures and names . . :D

i was thing of what language shall i use.. or what language is the best to work on this kind of project :)

hoping for your kind help guys. thanks :)



br
Frozenice

View 1 Replies View Related

Server Configuration For MSSQL 2000 And MSSQL 2005

Sep 6, 2006

Does enabling/disabling Data Execution Prevention have a performanceimpact on SQL 2000 or SQL 2005?For SQL best performance - how should I configure for:Processor Scheduling:Programs or Background servicesMemory Usage:Programs or System Cache

View 9 Replies View Related

Creating Index In MSSQL 2000 From MSSQL 2005

Mar 24, 2008

Hi,

I am a bit new to the MSSQL server. In our application, we use so many SQL queries. To imporve the performance, we used the Database enigine Tuning tool to create the indexes. The older version of the application supports MSSQL 2000 also. To re-create these new indexes, I have an issue in running these "CREATE INDEX" commands as the statements generated for index creation are done in MSSQL 2005. The statements include "INCLUDES" keyword which is supported in MSSQL 2005 but not in MSSQL 2000.

Ex:-

CREATE INDEX IND_001_PPM_PA ON PPM_PROCESS_ACTIVITY

(ACTIVITY_NAME ASC, PROCESS_NAME ASC, START_TIME ASC, ISMONITORED ASC)

INCLUDE

(INSTANCE_ID, ACTIVITY_TYPE, STATUS, END_TIME, ORGANIZATION);


Any help in creating such indexes in 2000 version is welcome.

Thanks,
Suresh.

View 2 Replies View Related

Generating Script For MSSQL 2000 From MSSQl 2005?

May 3, 2008

Hello
We are using SQL 2005 and now we are planning to use SQL 2000. what are the ways to do the process.

We taken the script spcificall for 2000 and run it in SQL 200. But we are getting the error in SCRIPT?

Could you please give me the step to do?

Thanks,
Sankar R

View 6 Replies View Related

Run Mssql 6.5 Client And Mssql 7.0 Server On Same Nt Workstaton?

Oct 26, 1999

Hello:

I am currently work on mssql 6.5. On my workstation, I have mssql 6.5
cient software.

However, I would like to install mssql 7.0 server on my nt workstation
and work with it to become familiar with 7.0. Can I install mssql 7.0
server on my nt workstation? Can mssql 6.5 client coexist with mssql 7.0
on the same machine if they are in different directories?

Thanks.

David Spaisman

View 1 Replies View Related

MSSQL Express 2005 Vs. MSSQL 2000

Jun 15, 2006

Ben writes "I have a sql script that doesn't function very well when it's executed on a SQL 2000 server.

The scrpt looks like this:


---------------------------------------------------------------------------------------------------
USE [master]
GO
IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
EXEC sp_addlogin N'SSDBUSERNAME', N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
If EXISTS (Select * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
ALTER LOGIN [SSDBUSERNAME] WITH PASSWORD=N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
IF EXISTS (select * from dbo.sysdatabases where name = 'ISIZ')
DROP DATABASE [ISIZ]
GO
USE [SurveyData]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
GO
USE [SurveyManagement]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
---------------------------------------------------------------


I need to be converted to a script that can be executed on both MSSQL 2000 and MSSQL 2005.

I was wondering if somebody there could help me with this problem?!

Thanks,
Ben"

View 1 Replies View Related

Migration MSSQL 2000 32-bit To MSSQL 2005 64-bit

Nov 17, 2007

I've been tasked to move our production databases on MSSQL 2000 to 2005. I've supported MSSQL since version 6.5 and performed migrations to successor versions.

Current Environment is MSSQL 2000 32-bit with current Service Packs.

I've performed mock migrations on Test servers upgrading all Production instances simultaneously from MSSQL 2000 to 2005 32-bit. The Test environment is identical to Production minus server name, IP etc. Also I have a separate server with MSSQL 2005 installed where I use the DETACH / ATTACH and BACKUP / RESTORE method for migration / acceptance testing. There are approximately 30 databases totaling 70 GB. This has gone as expected and fairly successful. Vendors have been coordinated with to update code and staff for acceptance testing.

I'd prefer going directly to MSSQL 2005 64-bit instead if possible due to memory benefits etc. This is where I'd like some feedback prior to borrowing a 64-bit server for testing.

Upgrade options:

1. Is it better to migrate from MSSQL 2000 32-bit to 2005 64-bit via:
a. DETACH / ATTACH
b. BACKUP / RESTORE
c. Is one method more advantageous relating to the end result?
2. Regarding XP clients, have issues been experienced with the default SQL Server driver or is an alternate recommended for XP clients to connect to a MSSQL 64-bit server databases?
3. If you have performed this migration and have relevant experience please pass them along.

View 3 Replies View Related

Deploying MSSQL 2005 Express DB To MSSQL 2005 WKGP Errors

Sep 29, 2006

DB is developed on local computer with MSSQL 2005 Express. My host is on MSSQL 2005 workgroup. Are they compatible, because I am getting errors? Is my approach wrong?

I have tried several approaches.

A) I created a backup of database on my local, then placed a copy on the server. Then I tried to restore through Server Management Studio. I get this error.

TITLE: Microsoft SQL Server Management Studio

------------------------------

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

ADDITIONAL INFORMATION:

The backed-up database has on-disk structure version 611. The server supports version 539 and cannot restore or upgrade this database.

RESTORE FILELIST is terminating abnormally. (Microsoft SQL Server, Error: 3169)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=08.00.2039&EvtSrc=MSSQLServer&EvtID=3169&LinkId=20476

------------------------------

BUTTONS:

OK

------------------------------



B: I also have tried copying the database. I put it in the same path as the other databases that can be read with server management studio on the server. Then, tried to get to it through server managements studio and it did not appear. So I tried to attach it. Then I received this error:

TITLE: Microsoft SQL Server Management Studio

------------------------------

Attach database failed for Server 'MROACH1'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------

ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Could not find row in sysindexes for database ID 10, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Could not open new database 'LodgingDB'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476

------------------------------

BUTTONS:

OK

------------------------------

C: I have also tried opening the Database, and back up file through Server Management Studio. without success.

D: I also tried Windows and Software update at microsoft update, but no updates were recommended for Version on Server.

I'm surprised this is so hard. My original data base was created in same family of software. 2005 MS SQL Express. I could use some direct help from someone experienced with this. Am I doing it wrong or are the DB versions incompatible.

Mark Roach





View 5 Replies View Related

SQL Equivalent Of MAX And IIF

Nov 23, 2005

I have looked around and found the equivalent for IIF (Access) to be aSELECT CASE in SQL. I have tried this with no success. I am also lookingfor the equivalent of MAX and have had no luck. The portion of thestring I am trying to SQL'ize is:SELECT Max(IIf([ADCN.ADCN] Is Null,0,[ADCN.ADCN])) AS ADCN FROM ADCNINNER JOIN Sheet ON ADCN.RecordID = Sheet.RecordID WHERE (Sheet.Drawing= '" & x & "') AND (Sheet.SheetNumber = 0);This portion is the most important:SELECT Max(IIf([ADCN.ADCN] Is Null,0,[ADCN.ADCN])) AS ADCN*** Sent via Developersdex http://www.developersdex.com ***

View 3 Replies View Related

SQL Sourcesafe Equivalent?

Aug 15, 2006

Recently, my company's deveolpment machine crashed. We had to format the harddrive which meant we lost some of our databases.
We managed to restore the databases, but we do not know in what state, i.e. which stored procedures were written between the restore point and the point the machine crashed.
Tow questions related to this:
1. I was wondering if there is any product that is similar to soursesafe but appied to databases, so that this problem will not happen again. Does Enterprise manager do something like this?
2. I was also wondering if there was anyway to undo an sql command. e.g. my colleague recently ran a command to update a database, but forgot to write the where clause!! That data was recovered aswell, but it would be nice to have some sort of undo button.
Thanks in advance.
Jagdip

View 1 Replies View Related

Reverse Equivalent To TOP

Dec 28, 2006

Is there anyway I can return only the last row of a query, like TOP does for the top most items?I would like to return something like this:SELECT BOTTOM 1 Column_CFROM Table1WHERE Column_A = somethingAny help would be greatly appreciated.  Thank you!  

View 3 Replies View Related

MS SQL Equivalent Of Substring_index

Jan 7, 2008

Hi everyoneI have a table 'users' with column 'residence' New York, NY Houston, TXSan Antonio, TX In MySQL I can select the city by running the following command SELECT SUBSTRING_INDEX(residence, ',' , 1) FROM users.  How would I accomplish the same thing using ms sql?  Thanks in advance 

View 2 Replies View Related

Rs.getrows Equivalent

Jul 10, 2004

Hi

Is there and equivalent of rs.getrows in asp.net? I want to fill an array quickly from a datareader?

ta
Lbob

View 2 Replies View Related

Equivalent To Autonumber

Jun 20, 2001

What is the equivalent to autonumber in SQL 7? I ported over some data into SQL but when I bring it up in Access 97 as linked tables it shows that
what used to be autonumber in Access is listed only as number in SQL. So what is the equivalent to Autonumber in SQL?

View 1 Replies View Related

Equivalent To ON UPDATE In SQL

May 6, 2008

!#perl

How do i structure my script to do the same thing in SQLExpress as in MySQL. My MySQL statement goes like:

ALTER TABLE groups ADD Last_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP AFTER Report_List

SQL does not recognize the ON UPDATE part, but i want the same function out of that collumn.

Any help here is greatly appreciated,
??
JOhn

View 11 Replies View Related

Sql Syntax Equivalent

Mar 12, 2007

Hello,

In this sql syntax
Quote: "SELECT table1.ID, table1.Catagory, table1.PostCount, table1.LastPostDate, table1.Description, table2.Username, table2.ID AS UserID FROM Catagories AS table1 INNER JOIN Users AS table2 ON table1.LastPostBy = table2.ID"

Is this the equivalent?

Quote: “SELECT table1.ID, table1.Catagory, table1.PostCount, table1.LastPostDate, table1.Description, table2Username, table2ID AS UserID FROM Categories AS table, Users AS table 2 WHERE table1.LastPostby = table2.ID”

View 7 Replies View Related

INDEXTYPE Equivalent ?

Jun 16, 2004

Hi,

There is a concept called INDEXTYPE in Oracle, Is there any equivallent for the same in SQL Server ?

Oracle example :

CREATE INDEX index1 ON test_table(col1) INDEXTYPE IS CTXSYS.CONTEXT

What is the SQL Server equivalent query for the above ?

Thanks,
Sam

View 1 Replies View Related

Set Autocommit Equivalent ?

Jul 8, 2004

Hi,

What is the SQL Server equivalent for "set autocommit on" of Oracle ?

Thanks,
Sam

View 4 Replies View Related

SQL Server Equivalent

Jul 9, 2004

I have 2 SQL statements in Visual Basic(with sybase as backend)
1) "set option DBA.MAX_STATEMENT_COUNT = 1069999900"
2) "set option DBA.MAX_CURSOR_COUNT = 1069999900"

And when I migrated the DB from Sybase to SQL server and try to run the vb code it is giving me error in that SQL statement as MS SQL server might not be recognising the above two statements. Is there an equivalent of this in SQL server.
Thanks

View 1 Replies View Related

Rownum Equivalent ?

Aug 16, 2004

Hi,

Rownum returns the serial number for the records in Oracle.
Id there an equivalent for the same in SQL Server ?

select rownum from test_table;

Please advise,

Thanks
Sam

View 1 Replies View Related

NOCACHE Equivalent ?

Oct 27, 2004

Oracle query :

create table test(sno int, sno1 int) NOCACHE

Is there any equivalent in SQL Server for the above (specifically for the NOCAHE syntax)

Please advice,

Thanks,
Sam

View 2 Replies View Related

Is There An Equivalent Syntax To TOP IN SQL?

May 16, 2006

Hi everyone, I am new to SQL, and would really appreciate help with this.

I have a database with the following fields:
IDNumber: sequential running from 1 to approx 50000
SURNAME: Surname
FNAME: Forename.

I want to return the last 100 IDNUmbers and return the surname and fname associated with the IDNumbers.
When I try TOP it gives me IDNumbers 1 to 100, is there an equilvant for the bottom 100 numbers.
Please help if you can.
Thanks
Scott

View 2 Replies View Related

Is There A C# Equivalent To Sysem_user?

Apr 11, 2008

is there a C# equivalent to system_user?

I asked my dev team but they all work from home on Fridays (read sleeping on their couches), and I have not heard back yet.

View 3 Replies View Related

Does MS SQL Have An Equivalent Function...?

Nov 16, 2006

...For Oracles DECODE function?

I am trying to get a conditional output RETURNed to the Grid output and have not found it in SQL Help. Help!!!

Here is Oracles example:

Select Distinct City,
DECODE (City, 'Cincinnati', 'Queen City', 'New York', 'Big Apple', 'Chicago',
'City of Broad Shoulders', City) AS Nickname
From Cities;

View 4 Replies View Related

SQLDMO Equivalent

Dec 18, 2006

jess writes "Hi,

IS there a component/way of retrieving a list of SQL Servers or databases on your local network for SQL 2005/Express. The same way sqldmo worked for a .net project.

thanks"

View 1 Replies View Related

To_char Sql Equivalent

Feb 15, 2007

Hello,

What is the sql equivalent of to_char?

Here is a line of code I am trying to fix.


ELSE to_char(COMPLET, 'DD-MM-YYYY') end)COMPLETE, DESCRIPTION, NAME, ADDRESS, JOB, TYP, NUM, OPR, sum(QTYW) QTY, sum(NCommissionAUT) CommissionAUT


Is there anything else in this line of code that I might need to change?

Thanks,

Kurt

View 6 Replies View Related

IIF Statement Equivalent

Feb 22, 2008

Hello,

I'm creating a view in SQL and am looking for something equivalent to the IIF ststement in Access.

Basically I want to create 2 new columns, which are based on the result of 1 of the other columns.

So if in my columns I have :

ID - NAME - FLAG - TIMEFROM - TIMETO
11 - Fred - 0 - 09:00 - 10:30
12 - John - 1 - 11:30 - 15:30
etc, etc, etc

I want to add the first new column saying something along the lines of "If Flag = 0 then DateTo - DateFrom, otherwise Null"

and then add a second column saying "If Flag = 1 then DateTo - DateFrom, otherwise Null"

Therefore the above would show :

ID - NAME - FLAG - TIMEFROM - TIMETO - NEWCOL1 - NEWCOL2
11 - Fred - 0 - 10:00 - 10:30 - 0:30 - Null
12 - John - 1 - 11:30 - 15:30 - Null - 4:00
etc, etc, etc

This in turn would give me 2 new columns which would show value 1 and value 2 - 1 being where the flag is not checked, and 2 being where the flag is checked.

Does this make sense ?

View 8 Replies View Related

Ms Sql Equivalent Of This Oracle

Feb 4, 2006

Hi.I'm a casual sql user. I have found a situation where I need to convert anoracle statement to tsql, one I can just fire off in any sql tool against anms sql server database.I studied the exists statement and I think I understand it somewhat, however Iwas not sure how to get it quite right. If you have an idea and a minute ortwo I'd appreciate any insight or tutorial.insert into authorization (program, optiontitle, usergroup, authorizationid)select 'EVERYWHERE','NAVIGATOR',usergroup, authorizationseq.nextvalfrom allgroups where exists (select * from authorizationwhere authorization.USERGROUP = allgroups.USERGROUP andauthorization.optiontitle = 'READ' and authorization.program = 'EVERYWHERE')I believe that because in my data, three values of usergroup from allgroupsreturn true from the exists, that this is supposed to insert three rows intoauthorization.But I can't figure out what to do about the authorization.nextval.. I triedvarious max(authorization)+1etc but nothing seemed to compile/workthanksJeff Kish

View 6 Replies View Related

Right Padding Equivalent

Jun 28, 2006

Hi everyone,Please excuse me if this has been asked before or sounds a bit dim.This is a question asked on another forum but the solutions beingoffered are focussing on programming rather than letting the DB serverdo the work, which I'm not sure is the most efficient solution.However, my confession is I dont use SQL server so can't help themdirectly with the syntax. Hopefully you can help me help them and learna little about SQL Server in the process.Trying to right pad a first name field so the padded string is a totalof 30 chars. It will be output concatenated with the last name field,and each field separated with a "|". So that when output it readssomething like:fname | mylastnameSyntax given was:select id,substring((last_name+','+rtrim(' '+isnull(level,'))+''+rtrim(isnull(first_name,'))+space(30)),1,30)+ ' | ' as student_namefrom studentIssue: It appears this is padding correctly but the spaces are notrendering in the browser. (I have no way to check this as I don't usesqlserver. However, I can understand that multiple spaces are not goingto render in the client browser, if indeed the query is padding withspaces.Question: Instead of using space(), can replicate() be used and aunicode space representation rather than an actual space be used? Or,is there a better way that will ensurethe padding shows in browser?I guess a fixed width font would also need to be used otherwise the30-char blocks could wind up being different widths, which would defeatthe purpose.If there is something I've missed, or you have any suggestions, I'mkeen to learn.TYhanks in advance,Lossed

View 13 Replies View Related







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