How to delete number (00) in a SQL Server column ?
how to delete number (00) in a SQL Server column ?
example :
column : Births before Births
after
199900
1999
198200
1982
200400
2004
help query
You use REPLACE function to selectively replace text inside a string in SQL Server. The REPLACE function is easy to use and very handy with an UPDATE statement.
SELECT Replace(births, '00', '')
or
update .....
Also you can use STUFF()
This function can be used for delete a certain length of the string and insert a new string in the deleted place.
Select STUFF ('199900', 5, 2, '')
--result 1900,1982,....
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/
Similar Messages
-
How to delete a row from a SQL Server CE Table with multiple JOINs?
I want to delete a record from a SQL Server CE table.
There are 3 tables scripts, options and results. I would like to remove a record from the results table. The where clause contains dynamic information which retrieved via other queries to different tables in the same database. These queries work fine and deliver
the desired data.
The Compact server is a clone of a remote table created using the sync framework. The same query to the remote table works fine.
The error I get is:
There was an error parsing the query. [ Token line number = 1,Token line offset = 10,Token in error = from ]
The code that throws the exception is as follows:
Dim connLoc As SqlCeConnection = New SqlCeConnection(My.Settings.ConnectionString)connLoc.Open() Dim strDel As String = "Delete r from ResultsTable r inner join OptionsTable o ON o.TestName=r.TestName inner join ScriptTable c ON r.TestName=c.TestName WHERE r.TestName = '" & ds1Loc.Tables(0).Rows(0)(1) & "' AND [Index] = '" & lstIndex & "'"Dim cmdDel As SqlCeCommand = New SqlCeCommandcmdDel.CommandText = strDelcmdDel.Connection = connLoccmdDel.ExecuteNonQuery()
The values held in ds1Loc.Tables(0).Rows(0)(1) and lstIndex are
correct so should not be the problem.
I also tried using parameterised queries
Dim strDel As String = "Delete r from [ResultsTable] r inner join [OptionsTable] o ON o.TestName=r.TestName inner join [ScriptTable] c ON r.TestName=c.TestName WHERE r.TestName = @TestName AND [Index] = @lstIndex"
Dim cmdDel As SqlCeCommand = New SqlCeCommand cmdDel.CommandText = strDel
With cmdDel.Parameters
.Add(New SqlCeParameter("@TestName", ds1Loc.Tables(0).Rows(0)(1)))
.Add(New SqlCeParameter("@lstIndex", lstIndex))
End With
cmdDel.Connection = connLoc cmdDel.ExecuteNonQuery()
I have tried replacing the "=" with "IN" in the the WHERE clause but this has not worked.
Is it the join that is causing the problem? I can do a select with the same search criteria and joins from the same database.
Also this query works with SQL Server. Is it perhaps that SQL CE does not support the Delete function the same as SQL Server 2008? I have been looking at this for a while now and cannot find the source of the error. Any help would be greatly appreciated.Hello,
In SQL Server Compact, we can use join in FROM clause. The DELETE statement fail may be caused by the FOREIGN KEY constraint.
Please refer to:
DELETE (SQL Server Compact)
FROM Clause (SQL Server Compact)
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
How to delete HFM Application Tables in SQL
Hi Gurus
1.How to delete HFM Application Tables in SQL?
Manually its deleting but each application having 120-150 tables? how to do this in a single shot?
I have deleted few applications using workspace/ shared services, but still its showing under HFM server under SQL Tables.
Please help me
regards
SmileeHi Smilee,
1. If the application can be opened in Financial Management web interface, go to the Manage Taskflows module and make sure that no taskflows still exist for this application. Delete any existing taskflows.
2. If the application exists in Shared Services, right click on the application in Shared Services and try to delete the application from there
3. Stop Hyperion Shared Services and all Financial Management Windows processes and take backups of the relational database schemas of both.
4. Check the relational database repository of Hyperion Shared Services, in the table "ces_apps" and make sure that there are no more rows containing the appname "EXAMPLE". If row still exists you should seek help from Oracle Global Software Support to clean up the Hyperion Shared Services before proceeding.
5. It is possible to remove all content for a deleted application from the Financial Management relational database. Extreme care should be taken when manually manipulating database tables as permanent damage can be done to the intended application and other applications if the wrong content is deleted.
a) Begin by deleting all tables, indexes, sequences and package objects that begin with the application name
b) Delete any tables beginning HSV_appname_xxxxxx
c) Delete any rows from the HSX_CLUSTER_xxxxx tables referring to the application.
d) Delete any rows from the HSV_ACTIVITY_KILL_USERS, HSV_ACTIVITY_NO_ACCESS, HSV_ACTIVITY_SESSIONS and HSV_ACTIVITY_USERS and HSV_USERS_ON_SYSTEM that refer to the application name.
d) Delete the row containing name of the application from the HSX_DATASOURCES table.
6. The next time all the Hyperion services are started again, the application should be safely removed from Windows client.
You can contact your DBA to write a query on how to delete it.
Hope this helps,
Thank you,
Charles Babu J -
How to delete the deployed composite in weblogic server 11g
Can someone tell me how to delete the deployed composite in weblogic server 11g ?I'm facing an issue where the weblogic server is getting started and immediately after sometime the server changes to "Force shutdown"..When i checked the logs,there is an error in one of the composite i deployed..So now i wanted to delete the deployed composite?Please help ....
ThanksHi
1. Deleting a domain will not hold any references. But make sure that under your user_projects/applications also remove the folder that matches with your domain. Basically under user_projects folder you will see 2 folders named applications and domains. When you create a domain say mySoaDomain, it will crate a folder with the same name under applications folder also with few files like em.ear. If you do this, then you can crate a new soa domain and use the same old name.
2. NOW comes the most important thing. If you create a new SOADomain, at one point, you had to give details for soainfra and mds schemas. If you give your current existing db details (that was used for your old deleted domain), then you may still have the issues. Because the soainfra db may still have the instances for your old process.
3. If you really want to have a full clean soa domain, here is what you do:
a) Run rcu and drop the existing schemas for soainfra and mds.
b) Run rcu again and create above schemas again.
c) Now create SOADomain using config wizard and refer above clean rcu db and you are all set.
3. Under your domain root folder, just searh for files named with your workflow and you should see the .jar location.
Thanks
Ravi Jegga -
Hii ..
need help on this ..
This what I am doing ..
I am using a DATAEXPORT function to export level0 data from my essbase 11.1.2.2 to Microsoft SQL 2008 tables.
So what I did first I exported the level0 data to a flat file using DATAEXPORT and the created the SQL columns by the same in that order only in my SQL table.
When I run it fails with this error:
ODBC Layer Error: [21S01] ==> [[DataDirect][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Column name or number of supplied values does not match table definition.]
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021014)
ODBC Layer Error: Native Error code [213]
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Error(1012085)
Unable to export data to SQL table [dataexp]. Check the Essbase server log and the system console to determine the cause of the problem.
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1021002)
SQL Connection is Freed
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Warning(1080014)
Transaction [ 0x1c50001( 0x51ee7d66.0x80342 ) ] aborted due to status [1012085].
[Tue Jul 23 18:26:07 2013]Local/dataexp/dataexp/admin@Native Directory/1209813312/Info(1012579)
Total Calc Elapsed Time for [test.csc] : [1.44] seconds
=============================================================
I did a simple test on my Sample.basic application then ..
loaded the calc data to it and then used the below script to export to a flat file
//ESS_LOCALE English_UnitedStates.Latin1@Binary
SET DATAEXPORTOPTIONS
DataExportLevel "Level0";
DataExportOverwriteFile ON;
DataExportColFormat OFF;
DataExportDimHeader OFF;
FIX(
"Jan",
"Sales",
"Actual"
/*DATAEXPORT "File" "," "/home/hypadmin/samtest.txt";*/
DATAEXPORT "DSN" "Abhitest" "sample" "sa" "welcome1";
ENDFIX
out put as below:
"Sales"
"100-30","California"
"Jan","Actual",145
Now In sql I created only 3 columns with name Jan/Sales/Actual and when I run this script again with comments removed .. I get the same error as what I have got in my first test case with other application ..
but when I create the columns with same name as what its in export
Sales/100-30/Califirnia/Jan/Actual
It created the new rows successfully ..
So with this I think the error which I am getting with my other application might be because of the same column issue .. but then I have created all the columns by looking at the export file only as I did in sample ..
Any idea would be helpful ..
Thanks
Abhishek
IFirst make sure you add
DataExportRelationalFile ON;
to your set commands it is missing
I alwats like to also add
DataExportColHeader dimensionName;
so I am sure what dimension is getting put into the columns.
Then count the number of dimensions in your outline (exclude attribute dimensions). You need at least that many columns in your table -1 + the number of members you will be returning as columns in the export
Taking your example Sample basic has 5 dimensions
Measures
Years
Scenario
Product
Market
Since you did not specify a dataexportcolheader it took the dense dimension Scenario as the columns. Your fix statement is limiting that to one member. Doing the math
5 -1 + 1 = 5 columns in your table which is what you found works. Suppose you fixed on bothe Actual and budget in scenario then you would need 6 columns 5 -1 +2 -
How to create user defined metrics for SQL Server target?
The customer is not able to create a user defined metrics for SQL Server target.
This is very important for him to use this product.
He is asking how to create user defined metrics?
I sent him Note 304952.1 How to Create a User-Defined SQL Metric in EM 10g Grid Control
But it would work for an Oracle DB, but his target is SQL Server DB
Not able to find the "User-Defined Metrics" link from Database home page.
How to create user defined metrics for SQL Server target?http://download-uk.oracle.com/docs/cd/B14099_19/manage.1012/b16241/Monitoring.htm
-
How to use open Row set in sql server 2014
Hello All,
How to open the row set using sql server 2014 using link server connection.Hi denyy,
Are you referring to the OPENROWSET function in SQL Server 2014?
The OPENROWSET method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data by using OLE DB. The examples below demonstrate how to use the OPENROWSET function:
A. Using OPENROWSET with SELECT and the SQL Server Native Client OLE DB Provider
SELECT a.*
FROM OPENROWSET('SQLNCLI', 'Server=Seattle1;Trusted_Connection=yes;',
'SELECT GroupName, Name, DepartmentID
FROM AdventureWorks2012.HumanResources.Department
ORDER BY GroupName, Name') AS a;
B. Using the Microsoft OLE DB Provider for Jet
SELECT CustomerID, CompanyName
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb';
'admin';'',Customers);
GO
C. Using OPENROWSET to bulk insert file data into a varbinary(max) column
USE AdventureWorks2012;
GO
CREATE TABLE myTable(FileName nvarchar(60),
FileType nvarchar(60), Document varbinary(max));
GO
INSERT INTO myTable(FileName, FileType, Document)
SELECT 'Text1.txt' AS FileName,
'.txt' AS FileType,
* FROM OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document;
GO
D. Using the OPENROWSET BULK provider with a format file to retrieve rows from a text file
SELECT a.* FROM OPENROWSET( BULK 'c:\test\values.txt',
FORMATFILE = 'c:\test\values.fmt') AS a;
Reference:
OPENROWSET (Transact-SQL)
Using the OPENROWSET function in SQL Server
Thanks,
Lydia Zhang
If you have any feedback on our support, please click
here. -
How to insert data from access to sql server ?
How to insert data from access to sql server ?
Please help me
thanksphamtrungkien wrote:
How to insert data from access to sql server by JAVA?The first four words of my last post:
masijade wrote:
JDBC with two connectionsGet a resultset from the jdbc-odbc bridge access connection, cycle through it and add batch insert commands to the jdbc connection to sql server. Give it a try and if the code has an error, then post your code ans ask a question.
The real question, though, is why you think it absolutely necessary to use Java for this. -
How to restore the Password backup in sql server 2005
How to restore the Password backup in sql server 2005
Hello,
THANKS............ BUT
I executed this query
RESTORE DATABASE new_data1
FROM DISK = 'd:\UK_DETAILS.bak'
with password ='selfinity123'
WITH MOVE 'UK_DETAILS.bak' TO 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\new_data1.mdf',
MOVE 'UK_DETAILS.bak' TO 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\new_data1.ldf'
I got the error
Msg 319, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon. -
How to call procedure in Java from SQL Server Database
Hello Every Body
i Have Question about
How to call procedure in Java from SQL Server Database
ThanksHi,
have you tried a Google search? I just gave it a 3 second try and already found: http://stackoverflow.com/questions/6113674/how-do-i-execute-a-ms-sql-server-stored-procedure-in-java-jsp-returning-table-d
Frank -
How do I make a connection to SQL Server Express using SQL Developer 1.5.3?
How do I make a connection to SQL Server Express using SQL Developer 1.5.3, if it's possible at all?
Also, I received a SQL Server dump file of some sort. Is there any way to read this file in SQL Developer and migrate the db to Oracle? Unfortunately I don't have raw DDL and DML for this database--just some sort of a binary dump file from SQL Server.
Thanks.
DanaAre you using SQL Developer 1.5.3 or 1.5.4?
If using an older version (i.e. 1.5.3), then you'll have to add a DLL to your environment. This is [ntlauth.dll].
If you don't find this DLL in your SQL Developer directory, then obtain the JDBC SQL SERVER Pluggin (jtds-1.2.2-dist.zip) from:
http://sourceforge.net/project/showfiles.php?group_id=33291&package_id=25350
Copy the ntlmauth.dll in the ...\\...\ide\lib directory (no need to register it).
Note: this approach should work if using DQL Developer 1.5.3 and SQL Server Express 2008
Regards,
M. R. -
How to find existing DAC connection to sql server
How to find existing DAC connection in sql server
Hi RoyalM,
Vishal has answered your initial question. If you have the connection issue. I suggest you elaborate the issue in a new thread.
You can access DAC using SQLCMD from a command prompt. Or check the existing DAC connection in a command prompt:
1. Open Command Prompt.
2. Type: SQLCMD –S <servername\instance> -d master and press Enter.
1> SELECT name,local_tcp_port FROM sys.dm_exec_connections ec join sys.endpoints e on (ec.endpoint_id=e.endpoint_id) WHERE e.name='Dedicated Admin Connection'
2> go
3. If it returns the result, it means there is an existing DAC connection. It also shows the port used by dedicated admin connection.
Thanks.
Tracy Cai
TechNet Community Support -
How to delete items in download queue on server side?
how to delete items in download queue on server side?
We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple. If you've tried deleting them and they keep re-appearing in your downloads then you will need to try contacting iTunes Support to get them removed : http://www.apple.com/support/itunes/contact/
-
Can you tell me how I can put the data of sql server into SAP to auto gener
Dear all,
Can you tell me how I can put the data of sql server into SAP to auto generate PR?
Best regards,
Merry zhangMany thanks ,it is ok now.
-
Storing 6 millions values in SQL server columns
Hi,
How many values (size) I can store in single SQL server column.
My Scenario,
Column1 Column2 Column3
1 ABC 1,2,3,........(6 millions values)
2 CDE 1,2,3,.......(6 millions values)
and problem is that I can't store them in rows. I need to store them in single column with comma separated.
What would be the best way to store them and retrieve them faster. I am thinking about converting it to byte[] or something but not sure how much time it will take to convert to byte and then again to text.and problem is that I can't store them in rows. I need to store them in single column with comma separated.
No you don't! Unless, that is, you really like to hurt yourself. It's a basic idea that in a relational database that each cell holds an atomic value, and this what relational datbases are optimised for.
That said, if all you want to do is to store a bunch of values that you will never look at in the database, but the database will act as an unintelligent data store you will only look at the values outside the database, then it
could make sense. However, a warning: just because you think that there is no requirement today, don't be surprised that you are sooner or later are asked questions like: "which the highest value for ABC?", "Which value is the most
frequent across ABCs and CDEs?". Questions that are very simple to answer is you have data in a properly designed data model. But extremely to painful to answer if your all values in a single column.
But if you take this, path, yes, storing values in a varbinary(MAX) with four bytes (or whatever that is needed) per value would be the best thing. It takes up less space than a string, and with fixed length it's easier to find value 198713 if this would
be nedded. You seem to be worried about conversion from byte to text. Why is not clear to me, since number are usally born binary. But obviously, I have no idea where you get these values from or how you would use them.
My initial recommendation still stands: store each value in a single row.
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
Auto Email on event - EEM script for NxOS
I generated EEM script for Duplicate IP address detection, but i do not know how to trigger email in NxOS. event manager environment emailto "[email protected]" event manager applet Duplicate_IP description "Detect Duplicate IP and Send Trap" eve
-
Hi Everyone, I have been trying to update iTunes, Safari, and Quicktime. Keep receiving "invalid signature" and then it removes the attempted download. Does anyone know how to fix this?
-
Is it possible to programatically enable/disable a schedule?
Hi, I'm looking for a way to start and stop an existing schedule based on certain criteria. Is it possible to enable/disable a schedule programatically, from within an Action block? Calling an HTTP URL for example? Thanks.
-
Tab Control Property Node gives a build error when used in a VI for LabVIEW PDA
Hello, Iam new to LabVIEW development & need help regarding this: We are trying to port a LabVIEW application from desktop to a Windows Mobile PDA. Please note that the LabVIEW application works fine on the desktop. In one of the VIs, a Tab c
-
CS5 photoshop keep crashing?
This is driving me insane. Everytime I open photoshop it opens up and straight away crashes. Yes I have it updated. It happens with Illustration CS5 too, but Flash CS5 seems to fine. I am a college student so I need this for my final assignments, and