Substr Sql Equivalent Command?

Feb 15, 2007

Hello,

What is the substr equivalent command in sql?

Thanks,

Kurt

View 1 Replies


ADVERTISEMENT

Is There An Equivalent Table Copy Command In Ms Sql A La Oracle?

Apr 15, 2004

is there a command in ms sql server 2000 equivalent to this oracle table copy command?

create table myTable_bak as select * from myTable;

View 1 Replies View Related

SQL Server 2005 &&>&&> - ? Need Equivalent Command ? - Show Tables&&>&&> (MySql)

Feb 19, 2008

Hi Guys,

well as you can see from my thread SQLServer is new to me i am used to mysql and i c'ant find the equivalent anywhere on the net... Seams easy enough but i have been at it for 6 hrs and i give up... I am just making a quick database view tool. So please tell me.

How do i load the all tables of a database via an sql command?

Since it took me a while to find this i thought migth as well slap ip somewhere so here is the command to load all data bases... In any case worked for me so...

- > select * from master.dbo.sysdatabases;

And where in the ... can you find a reference to all sql server commands? ... Please.

Thanks for your help

View 4 Replies View Related

What The Equivalent Command IN SQL SERVER EXPRESS To POSTGRESQL BEGIN ROLLBACK And COMMIT

Jun 27, 2007

Hello,

First of all, this is my first time using SQL SERVER 2005 express, before that i'm using POSTGRESQL database.

I would like to know how what's the equivalent command for "BEGIN","ROLLBACK","COMMIT", these are the POSTGRESQL COMMAND use to start transaction, rollback transaction and commit transaction.

Example when i use this kind of command is . I need to insert data into 3 table. before insert into table1, i issue "begin", start to insert data into table1, if table1 no error, then i proceed to table 2 and table3. if table2 and table3 no error. then issue "commit" to commit the changes. but if any error happen between table1 and table 2 or table 2 and table3, i will issue "rollback" to roll any changes that i make to table1, table2 and table3.

Maybe some one can teach me how to achieve using SQL SERVER 2005 EXPRESS.

Thanks and Regards.

Beh Chun Yit

View 1 Replies View Related

Help With SUBSTR Syntax

Dec 21, 2004

I need help with my statement using the SUBSTR. ( And this is not the MS SQL - but some flavor like it that we use on our AS400)


SELECT DISTINCT codstrctn, coacctno, cosrvlcn, losrvlctyp, losrvlcsts,
losrvlcnm, losrvlcnml, losrvlc, losrvlcn1, losrvlctyn,
losrvlcstc, losrvlczpc, cobstypcd, cosyscode, coctqty, cocntsz,
covolcd, cosrvschcd, copdycd001, copdycd002, copdycd003,
copdycd004, copdycd005, copdycd006, copdycd007, coonclflg,
cocmprsnfl, rachgamt, rahlrt, cbblnmln, cbblnmln1, cbblstn,
cbblstnm, cbblctynm, cbblstcd, cbblzpcd, racurr
FROM siqsprod/sipcontr, siqsprod/siplocat, siqsprod/sipcbill,
siqsprod/siprate
JOIN codstrctn.01=lodstrctn.02 AND coacctno.01=loacctno.02 AND
cosrvlcn.01=losrvlcn.02 AND codstrctn.01=cbdstrctn.03 AND
coacctno.01=cbacctno.03 AND codstrctn.01=radstrctn.04 AND
coacctno.01=raacctno.04 AND cosrvlcn.01=rasrvlcn.04
WHERE losrvlcnm CONTAINS 'SCHLOTSKY' AND racurr='C' AND
SUBSTR(losrvlcstc,2,2) IN('GA','TX') OR
losrvlcnml CONTAINS 'SCHLOTSKY' AND racurr='C' AND
SUBSTR(losrvlcstc,2,2) IN('GA','TX') OR
cbblnmln CONTAINS 'SCHLOTSKY' AND racurr='C' AND
SUBSTR(losrvlcstc,2,2) IN('GA','TX') OR
cbblnmln1 CONTAINS 'SCHLOTSKY' AND racurr='C' AND
SUBSTR(losrvlcstc,2,2) IN('GA','TX')
GROUP BY
HAVING
UNION
ORDER BY

I'm sure I haven't told you enough. I'm trying to write a query that will allow me to put in a number of different states for each search, so that I don't have to write additional lines for every state. So I'm taking a stab at doing this and it didn't return any data. Yet if I take out the statement about the SUBSTR it returns data. So can any one please set me in the right direction.

Thanks . . .
texasalynn

View 9 Replies View Related

Updating Column Using Replace And SubStr?

Mar 26, 2015

I have an update where I need to replace the first two numbers of a string with SF and remove the last number - e.g.:

029929229 >> SF992922

I have an update statement which works in Oracle, but I cannot get it to work in SQL Server. The statement is below:

UPDATE oraowner.ems_sam
SET sam_id = replace(sam_id,sam_id,'SF'||substr(sam_id, 3, length(sam_id) - 3));

View 3 Replies View Related

Defining Command,commandtype And Connectionstring For SELECT Command Is Not Similar To INSERT And UPDATE

Feb 23, 2007

i am using visual web developer 2005 and SQL 2005 with VB as the code behindi am using INSERT command like this        Dim test As New SqlDataSource()        test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").ToString()        test.InsertCommandType = SqlDataSourceCommandType.Text        test.InsertCommand = "INSERT INTO try (roll,name, age, email) VALUES (@roll,@name, @age, @email) "                  test.InsertParameters.Add("roll", TextBox1.Text)        test.InsertParameters.Add("name", TextBox2.Text)        test.InsertParameters.Add("age", TextBox3.Text)        test.InsertParameters.Add("email", TextBox4.Text)        test.Insert() i am using UPDATE command like this        Dim test As New SqlDataSource()        test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString").ToString()        test.UpdateCommandType = SqlDataSourceCommandType.Text        test.UpdateCommand = "UPDATE try SET name = '" + myname + "' , age = '" + myage + "' , email = '" + myemail + "' WHERE roll                                                         123 "        test.Update()but i have to use the SELECT command like this which is completely different from INSERT and  UPDATE commands   Dim tblData As New Data.DataTable()         Dim conn As New Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated                                                                                Security=True;User Instance=True")   Dim Command As New Data.SqlClient.SqlCommand("SELECT * FROM try WHERE age = '100' ", conn)   Dim da As New Data.SqlClient.SqlDataAdapter(Command)   da.Fill(tblData)   conn.Close()                   TextBox4.Text = tblData.Rows(1).Item("name").ToString()        TextBox5.Text = tblData.Rows(1).Item("age").ToString()        TextBox6.Text = tblData.Rows(1).Item("email").ToString()       for INSERT and UPDATE commands defining the command,commandtype and connectionstring is samebut for the SELECT command it is completely different. why ?can i define the command,commandtype and connectionstring for SELECT command similar to INSERT and UPDATE ?if its possible how to do ?please help me

View 2 Replies View Related

Using A Variable In SSIS - Error - Command Text Was Not Set For The Command Object..

Nov 4, 2006

Hi All,

i am using a OLE DB Source in my dataflow component and want to select rows from the source based on the Name I enter during execution time. I have created two variables,

enterName - String packageLevel (will store the name I enter)

myVar - String packageLevel. (to store the query)

I am assigning this query to the myVar variable, "Select * from db.Users where (UsrName = " + @[User::enterName] + " )"

Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, enterName,. I select that and when I click on OK am getting this error.

Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object.".

Can Someone guide me whr am going wrong?

myVar variable, i have set the ExecuteAsExpression Property to true too.

Please let me know where am going wrong?

Thanks in advance.








View 12 Replies View Related

Do Somebody Know How Long (in Chars) Script(command) Can Be Solved By SQL Command?

Aug 30, 2004

Do somebody know how long (in chars) script(command) can be solved by SQL Command?
Thanks

View 1 Replies View Related

What Command Is Used To Get Back The Privileges Offered By The GRANT Command?

Mar 10, 2007

reply.

View 1 Replies View Related

Command Text Was Not Set For The Command Object Error

Sep 19, 2006

Hi. I am writing a program in C# to migrate data from a Foxpro database to an SQL Server 2005 Express database. The package is being created programmatically. I am creating a separate data flow for each Foxpro table. It seems to be doing it ok but I am getting the following error message at the package validation stage:

Description: An OLE DB Error has occured. Error code: 0x80040E0C.

An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object".

.........

Description: "component "OLE DB Destination" (22)" failed validation and returned validation status "VS_ISBROKEN".

This is the first time I am writing such code and I there must be something I am not doing correct but can't seem to figure it out. Any help will be highly appreciated. My code is as below:

private bool BuildPackage()

{




// Create the package object

oPackage = new Package();

// Create connections for the Foxpro and SQL Server data

Connections oPkgConns = oPackage.Connections;

// Foxpro Connection

ConnectionManager oFoxConn = oPkgConns.Add("OLEDB");

oFoxConn.ConnectionString = sSourceConnString; // Created elsewhere

oFoxConn.Name = "SourceConnectionOLEDB";

oFoxConn.Description = "OLEDB Connection For Foxpro Database";

// SQL Server Connection

ConnectionManager oSQLConn = oPkgConns.Add("OLEDB");

oSQLConn.ConnectionString = sTargetConnString; // Created elsewhere

oSQLConn.Name = "DestinationConnectionOLEDB";

oSQLConn.Description = "OLEDB Connection For SQL Server Database";

// Add Prepare SQL Task

Executable exSQLTask = oPackage.Executables.Add("STOCK:SQLTask");

TaskHost thSQLTask = exSQLTask as TaskHost;

thSQLTask.Properties["Connection"].SetValue(thSQLTask, "oSQLConn");

thSQLTask.Properties["DelayValidation"].SetValue(thSQLTask, true);

thSQLTask.Properties["ResultSetType"].SetValue(thSQLTask, ResultSetType.ResultSetType_None);

thSQLTask.Properties["SqlStatementSource"].SetValue(thSQLTask, @"C:LPFMigrateLPF_Script.sql");

thSQLTask.Properties["SqlStatementSourceType"].SetValue(thSQLTask, SqlStatementSourceType.FileConnection);

thSQLTask.FailPackageOnFailure = true;



// Add Data Flow Tasks. Create a separate task for each table.

// Get a list of tables from the source folder

arFiles = Directory.GetFileSystemEntries(sLPFDataFolder, "*.DBF");

for (iCount = 0; iCount <= arFiles.GetUpperBound(0); iCount++)

{


// Get the name of the file from the array

sDataFile = Path.GetFileName(arFiles[iCount].ToString());

sDataFile = sDataFile.Substring(0, sDataFile.Length - 4);

oDataFlow = ((TaskHost)oPackage.Executables.Add("DTS.Pipeline.1")).InnerObject as MainPipe;

oDataFlow.AutoGenerateIDForNewObjects = true;



// Create the source component

IDTSComponentMetaData90 oSource = oDataFlow.ComponentMetaDataCollection.New();

oSource.Name = (sDataFile + "Src");

oSource.ComponentClassID = "DTSAdapter.OLEDBSource.1";

// Get the design time instance of the component and initialize the component

CManagedComponentWrapper srcDesignTime = oSource.Instantiate();

srcDesignTime.ProvideComponentProperties();

// Add the connection manager

if (oSource.RuntimeConnectionCollection.Count > 0)

{


oSource.RuntimeConnectionCollection[0].ConnectionManagerID = oFoxConn.ID;

oSource.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(oFoxConn);

}

// Set Custom Properties

srcDesignTime.SetComponentProperty("AccessMode", 0);

srcDesignTime.SetComponentProperty("AlwaysUseDefaultCodePage", true);

srcDesignTime.SetComponentProperty("OpenRowset", sDataFile);

// Re-initialize metadata

srcDesignTime.AcquireConnections(null);

srcDesignTime.ReinitializeMetaData();

srcDesignTime.ReleaseConnections();

// Create Destination component

IDTSComponentMetaData90 oDestination = oDataFlow.ComponentMetaDataCollection.New();

oDestination.Name = (sDataFile + "Dest");

oDestination.ComponentClassID = "DTSAdapter.OLEDBDestination.1";

// Get the design time instance of the component and initialize the component

CManagedComponentWrapper destDesignTime = oDestination.Instantiate();

destDesignTime.ProvideComponentProperties();

// Add the connection manager

if (oDestination.RuntimeConnectionCollection.Count > 0)

{


oDestination.RuntimeConnectionCollection[0].ConnectionManagerID = oSQLConn.ID;

oDestination.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(oSQLConn);

}

// Set custom properties

destDesignTime.SetComponentProperty("AccessMode", 2);

destDesignTime.SetComponentProperty("AlwaysUseDefaultCodePage", false);

destDesignTime.SetComponentProperty("OpenRowset", "[dbo].[" + sDataFile + "]");



// Create the path to link the source and destination components of the dataflow

IDTSPath90 dfPath = oDataFlow.PathCollection.New();

dfPath.AttachPathAndPropagateNotifications(oSource.OutputCollection[0], oDestination.InputCollection[0]);

// Iterate through the inputs of the component.

foreach (IDTSInput90 input in oDestination.InputCollection)

{


// Get the virtual input column collection

IDTSVirtualInput90 vInput = input.GetVirtualInput();

// Iterate through the column collection

foreach (IDTSVirtualInputColumn90 vColumn in vInput.VirtualInputColumnCollection)

{


// Call the SetUsageType method of the design time instance of the component.

destDesignTime.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READWRITE);

}

//Map external metadata to the inputcolumn

foreach (IDTSInputColumn90 inputColumn in input.InputColumnCollection)

{


IDTSExternalMetadataColumn90 externalColumn = input.ExternalMetadataColumnCollection.New();

externalColumn.Name = inputColumn.Name;

externalColumn.Precision = inputColumn.Precision;

externalColumn.Length = inputColumn.Length;

externalColumn.DataType = inputColumn.DataType;

externalColumn.Scale = inputColumn.Scale;

// Map the external column to the input column.

inputColumn.ExternalMetadataColumnID = externalColumn.ID;

}

}

}

// Add precedence constraints to the package executables

PrecedenceConstraint pcTasks = oPackage.PrecedenceConstraints.Add((Executable)thSQLTask, oPackage.Executables[0]);

pcTasks.Value = DTSExecResult.Success;

for (iCount = 1; iCount <= (oPackage.Executables.Count - 1); iCount++)

{


pcTasks = oPackage.PrecedenceConstraints.Add(oPackage.Executables[iCount - 1], oPackage.Executables[iCount]);

pcTasks.Value = DTSExecResult.Success;

}

// Validate the package

DTSExecResult eResult = oPackage.Validate(oPkgConns, null, null, null);

// Check if the package was successfully executed

if (eResult.Equals(DTSExecResult.Canceled) || eResult.Equals(DTSExecResult.Failure))

{


string sErrorMessage = "";

foreach (DtsError pkgError in oPackage.Errors)

{


sErrorMessage = sErrorMessage + "Description: " + pkgError.Description + "";

sErrorMessage = sErrorMessage + "HelpContext: " + pkgError.HelpContext + "";

sErrorMessage = sErrorMessage + "HelpFile: " + pkgError.HelpFile + "";

sErrorMessage = sErrorMessage + "IDOfInterfaceWithError: " + pkgError.IDOfInterfaceWithError + "";

sErrorMessage = sErrorMessage + "Source: " + pkgError.Source + "";

sErrorMessage = sErrorMessage + "Subcomponent: " + pkgError.SubComponent + "";

sErrorMessage = sErrorMessage + "Timestamp: " + pkgError.TimeStamp + "";

sErrorMessage = sErrorMessage + "ErrorCode: " + pkgError.ErrorCode;

}

MessageBox.Show("The DTS package was not built successfully because of the following error(s):" + sErrorMessage, "Package Builder", MessageBoxButtons.OK, MessageBoxIcon.Information);

return false;

}

// return a successful result

return true;
}

View 2 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

Equivalent To SQL Anywhere GET_IDENTITY?

Nov 27, 2006

Is there an equivalent in mssql to SQL Anywhere's GET_IDENTITY whichreserves the next autoinc value for a table? Yes I know about@@Identity and SCOPE_IDENTITY. I need to get the next autoinc value_before_ I insert the record due to the way the existing applicationworks.I've seen DBCC CHECKIDENT mentioned but that seems kludgy to me.TIA,Jim

View 13 Replies View Related







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