this sql statement doesn't content any error but if the sentences that want to insert into table contain symbol ' then it will process error when enter into table. ( data contain symbol ' can't insert into table).
May i know how to solve this problem.
i did refer to my friends they said need include java class, but they not sure what's the class that i need.
So i help i can get the help here.
Thank in advance
Hi, I am a bit confused on the many uses of the @ symbol, such as in assignments and in use by stored procedures. I am not quite clear on when it needs to be used and when it doesn't, what it means, etc. Could someone either point me to a good reference, or explain? (I have read several books on MS Sql server, but somehow missed this.) I use the symbol, but I don't understand when to use it and when not to, without referencing an example. Thanks,
I have SQL Server 2000 SP3 and the default Code Page is:
I have a Table with a column of the type 'text'. In this column sometimes it's necessary introduce the euro symbol (€). Now, when we write this symbol, after the SQL Server show it with a '?'.
I tried change the column collation to 'Latin1_General_CI_AI', ‘SQL_Latin1_General_CP1_CI_AI’ and ‘SQL_Latin1_General_CP850_CI_AI’ but there is the same problem.
SELECT ROW_NUMBER() OVER (ORDER BY BM.BILL_NUMBER_V) AS [SL_NO],PP.KID_ID_NO_V AS [KID_NO],(PP.FIRSTNAME_V + SPACE(1) + PP.LASTNAME_V)AS [PATIENT_NAME], CONVERT(VARCHAR(10),PP.UPDATEDDATE_D,101)AS [VISIT_DATE],BM.BILL_NUMBER_V AS [BILL_NUMBER],CONVERT(VARCHAR(10),BM.BILL_DATE_D,101) AS [BILL_DATE], ROUND(BM.BILL_AMOUNT_M,2) AS [BILL_AMOUNT],ROUND(BM.CONCESSION_AMOUNT_M,2) AS [CONCESSION_AMOUNT],ROUND(BM.TOTAL_AMOUNT_M,2) AS [TOTAL_AMOUNT],
[Code] .....
In the above query i want to concat symbol '%' for output of percentage column. How to do that?
I'm having a problem with the Euro symbol on my SQLServers which all have characterset 850 and Unicode collation 1033. As far as I can see charset 850 does not contain the € symbol, but if I run a query
DECLARE @nstring nchar(12) SET @nstring = N'€' SELECT UNICODE(@nstring), NCHAR(UNICODE(@nstring))
Result: 8364 €
So the Unicode character 8364 is the Euro symbol. My question now is how do I have to write a statement so that the € symbol is shown in the output. I need to use something like the following: Select 'Costs:'+ € + convert(money, table1.costs) Result: € 123.00
I tried several options but never get the right output. Is there any way of doing it or do I have to change the characterset.
We are running SQL Version 7.0. I recently set up a simple snapshot replication. After restarting enterprise manager a hand symbol showed up under the database barrel as if a share symbol. Am I correct in assuming the symbol means replication. Is there a source that explains what the various symbols mean?
We are getting 67.2,62.4,81.9 these are percentages these are rounded values..so in my report I would like to add % symbol for them I have written expression like this
=left(Fields!Sales_Margin_TY____.Value,4) & "%"
but I was getting 67.1Â in place of 67.2Â
I dont want to change the figures which is coming from source...
Just I want to add % for those values... how to do that ..
I am looking for a way to remove the printer symbol from the report manger because it dows not work on some client machines because they are locked down. For us it is completely sufficient to export to PDF.
Is there a setting or an entry in the web config or something else. A hint would be helpful
I'm working of a project that has each row of column data stored in this format: AAChieve Initiative - Business Development Consultant|Marketing|4F|210710 Is there a way I can break this rows apart with TSQL based of the | symbol? Thanks in advance!
IF EXISTS (SELECT * FROM sys.objects WHERE name = 'TwoDigitsNumber' AND type = 'FN') DROP FUNCTION MinimumOFThree; GO CREATE FUNCTION TwoDigitsNumber(@a int) RETURNS nvarchar(20)
[Code] ....
The only first letter 'f', 's', 'e' is inserted in value instead 'first', 'second', 'equal'.
I have amount field in my table as decimal. I need a query to display the amount with dollar or euro symbol based on country selection. The country also in same table.
For example If country is US then Amount $1200, If country is UK then Amount €1200.
And so far so good I get the three options to export to,
If I Export using the ASCII Rendering my pound signs come out as question marks (?) and subsequently loads into Excel as a general data type and is not sum-able.
If I Export using UTF-8 Rendering my pound signs come out as a weird character followed by a pound sign, again opened in excel loads as a General data type and is not summable.
If I export using UNICODE rendering, by file sizes are doublesd as you would expect, and then when you open in excel it is all bunched up in column 1, both un-acceptable.
Interestingly enough If I take the UTF-8 file I have and convert it to ASCII using Ultraedit, notepad or wordpad, everything works fine, the £ is correctly encoded, Excel loads it OK and it is summable, result, but I can not use get my end users to perform this "kludge" for an export.
I'd like the state of the function bars to stay at whatever it was as the user moves from one report to the next rather than opening to full each time a new report is opened. Can this be done through a setting or programatically at teh report level? Is there a <default_toolbars_OpenState> tag or something?
Is it possible to include a currency symbol in an amount-field in PowerPivot/Pivottable based on a Currency column in a table? Something as the same as with SSAS MD. And I don't want fixed values in my code.
I have a select statement like this: select IsVerified from AppForm the IsVerified returns 'True' ...can I convert that value to 'Yes' by using some sort of function?
ok i am very very new at this, ive downloaded the SQL 2005 trial and i can not seem to figure this out. I have a .xls i want to make a active sql page out of. please please help me with this
the .xls is here http://www.mediafire.com/?5jtgzcxb232
Once a week there is a sqlscript, which should run and store data to a txt file.
There is a tablle in which imagedata is stored in RAW format(that one with small boxes, Qmarks and dots...).
Now i want to export it to the txtfile as HEX, so i can decode it by php further.
With the thumbnail, also stores there everything is fine, the SQL looks that way:
SELECt hex(thumbnail) FROM picTable where id_pic=54985
The Data is then displayed as HEX. But the standart picture is to big. When i use the statement: SELECt hex(bigpic) FROM picTable where id_pic=54985
i got the error message:
An error occurred while running the query.
The data type, length, or value of argument 1 of HEX is invalid.
(SQL code = -171, SQL state = 42815)
After some research i found that the maximum lenght is 16 336 bytes for the HEX-operation. The picture is nearly 30 000 bytes... :shocked: Have anyone an idea how to fix that? I am not able here to accsess to the database direct...
Hi All, I am in the process of changing the cursor based Proc with temp tables, I have one of the Procs which is beening used to get a value for the cursor, I am thinking if it is possible to change it to a function so that I can update the column at once.
[code] CREATE PROCEDURE[dbo].[get_cre_tijd_id] ( @tijd_datum datetime, @tijd_id int output ) AS
SET @datum_tekst = CAST(@tijd_datum AS VARCHAR); SET @datum_tijd = CONVERT(DATETIME, SUBTRING(@datum_tekst, 1, 12), 21 ) SET @tijd_id = (SELECT tijd_id FROM dim_tijd WHERE tijd_datum = @datum_tijd )
IF @tijd_id IS NULL BEGIN INSERT INTO dim_tijd ( tijd_datum , jaar , kwartaal , maand , dag , periode , week , weekdag ) VALUES ( @datum_tijd , datepart(yy,@tijd_datum) , datepart(q,@tijd_datum) , datepart(m,@tijd_datum) , datepart(d,@tijd_datum) , ceiling(datepart(wk,@tijd_datum)/4.00) ,dbo.get_iso_week(@tijd_datum) , datepart(dw,@tijd_datum) )
SET @tijd_id = (SELECT tijd_id FROM dim_tijd WHERE tijd_datum = @datum_tijd) END
I am subtracting two datetimes (last(fields!FaultStart.value))-(first(fields!FaultStart.value)) this works fine and returns a value in a textbox 5.23:44:23. I need to convert that number to minutes I am very new to sql programming and do not know very many commands. I am using Microsoft sql server 2005 express edition along with sql server business intelligence development studio where I placed a textbox and entered the expression above. I have also tried to use datediff command =datediff(second, (last(fields!FaultStart.value)),(first(fields!FaultStart.value))) but the second is underlined and tooltips says WRONG NUMBER OF ARGUMENTS I€™ve tried =datediff(€œsecond€?, (last(fields!FaultStart.value)),(first(fields!FaultStart.value))) and =datediff(€œ€™second€™€?, (last(fields!FaultStart.value)),(first(fields!FaultStart.value))) also for second I€™ve tried seconds. Any help would be most appreciated
I haven't seen a really good solution for this in amongst the threads about UTC. What I want to do is convert a date time to UTC, taking into account whether or not it is in DST, and be able to deploy this code to any server in the world without customizing the SQL code, and have it know how to convert, as long as a I feed it the local Time Zone.
I would think this would be easy because the OS knows at any given time what time zone has what UTC offset, and exactly at what time DST starts and ends. Right now I do this, but it is limited. I have a table that, for each site (there can be more than one site in different time zones) stores the UTC offset and whether or not the site observes DST. New York would have the "Observes_DST" set to 1, Phoenix would have it set to zero. The "Hours_To_UTC" value would be 5 for New York.
This code below assumes all sites are located in Canada or the US, as Canada and the US now use the second Sunday in March and first Sunday in November as the switch over times. (although this would work fine for countries like India and China that don't observe DST).
UPDATE a
SET Time_Arrived_UTC =
CASE
WHEN b.Observes_DST = 1 THEN
CASE
WHEN Month(Time_Arrived) IN (4,5,6,7,8,9,10) THEN
DATEADD(hh,b.Hours_From_UTC - 1,Time_Arrived)
WHEN Month(Time_Arrived) = 3 AND Day(Time_Arrived)- DATEPART(dw,Time_Arrived) >= 7 AND
Day(Time_Arrived) <= 14 AND DATEPART(dw,Time_Arrived) <> 1
then DATEADD(hh,b.Hours_From_UTC - 1,Time_Arrived)
WHEN Month(Time_Arrived) = 3 AND Day(Time_Arrived) > 14
then DATEADD(hh,b.Hours_From_UTC - 1,Time_Arrived)
WHEN Month(Time_Arrived) = 3 AND Day(Time_Arrived) >= 8 AND Day(Time_Arrived) <= 14 AND
DATEPART(dw,Time_Arrived) = 1 AND DATEPART(hh,Time_Arrived) >= 2
THEN DATEADD(hh,b.Hours_From_UTC - 1,Time_Arrived)
WHEN Month(Time_Arrived) = 11 AND Day(Time_Arrived) <= 7 AND DATEPART(dw,Time_Arrived) = 1 AND
DATEPART(hh,Time_Arrived) < 2 then DATEADD(hh,b.Hours_From_UTC - 1,Time_Arrived)
WHEN Month(Time_Arrived) = 11 AND Day(Time_Arrived)- DATEPART(dw,Time_Arrived) < 0 then
DATEADD(hh,b.Hours_From_UTC - 1,Time_Arrived)
ELSE DATEADD(hh,b.Hours_From_UTC,Time_Arrived)
END
ELSE DATEADD(hh,b.Hours_From_UTC,Time_Arrived)
END FROM
Facts_Table a INNER JOIN Site_Info_Lookup_Table b
ON a.Site_Name= b.Site_Name
This works, (and is much more efficient than using a UTC lookup table) and I could probably go about hard coding various other start and end DST datetimes for other time zone DST (Australia and Europe, for example), but that wouldn't be dynamic in case one country makes a change in policy that changes when DST starts and stops, like the US just did.
SQL Server only provides current time UTC conversion--I would think it should have a function like this:
ConvertToUTC(datetimevalue,timezone)
Oracle has a function like that, but it is useless because it doesn't take into account DST, it would for instance just add 5 hours to EST for every date you entered (now that's helpuful!). It is baffling that this function doesn't exist.
I am using Integration Services so I could probably build a script task that would query the OS for DST start and stop times given a particular time zone (if available), but I'm not much of a coder--would be nice to have an easy way to do it in Transact-SQL.
I'm needing to take a value inputted by a user via html form and convert it to a hex value upon inserting into SQL2000 db. I only need to store the 8 chars after "0x". Is there any T-SQL that can pull this off? CAST or CONVERT? Sorry if this is a silly question and hope I supplied enough info...
Hi I am converting data from old DB to NEW DBIn the OLD table fields like "PhoneNumber" the data enterd are [ 657 985-986, (03)-987-543, 675(89)00, ect]Is their any function in sql where I can get rid of all those spaces and () and - between the numbers as my new field is only numbers and with out spaceOtherwise I have to clean them up manually as I have 1000000 records cheers
I have a stored procedure which I user to retur an Email-address from aspnet_Membership (DB-table). Here is the code: ALTER PROCEDURE dbo.StoredProcedure2 @user nvarchar(256) AS DECLARE @id uniqueidentifier SET @id = '' SELECT @id = UserId from aspnet_Users WHERE UserName = @user SELECT Email From aspnet_Membership WHERE UserId = @id I use StoredProcedure2 in this way: Dim cmd As SqlCommand = New SqlCommand("StoredProcedure2", MyConnection) cmd.CommandType = CommandType.StoredProcedure 'send in UserName as @User to StoredProcedure2 cmd.Parameters.Add("@user", SqlDbType.NVarChar).Value = User.Identity.Name.ToString() 'Return EmailAddresse returnValue = cmd.ExecuteScalar() Message I get is: "Conversion failed when converting from a character string to uniqueidentifier" Please help...
Hi, I am developing a project that using the one of the starter kits which use the MS SQL EXPRESS database.The project is almost ready to be launch. few questions:
I am looking for a good host with good support reasonable paid. What is my options if I would like to convert from the current database, to other databases like MySql, MS SQL Server or any? which tools can help with this convertions? thats all, thanks.
I have an old table (table1) and a new table (table2). I need to move some of the data from table1 to table2. For my example, table1 contains 1 field that is a DateTime, we’ll call it table1_Date. table2 also contains 1 field that is a SmallDateTime, we’ll call it table2_Date. I want to do something like this: Insert into table2 table2_Date Select table1_Date From table1 Where ….. I am getting the following error: The conversion from datetime data type to smalldatetime data type resulted in a smalldatetime overflow error. How can I go about converting this on the insert?