Needed Sql Script To Convert Binary Content
Apr 1, 2007
Hi all,
how r u everyone, guys i need a help, i have a interface in my application, adding attachments to issues, ie users can attach a file for a particular issue and if anyone have to view they ve click a link and it will download.
iam using filestream and binaryreader concept in that, ie read the file using filestream and then use binaryreader.readbytes method to convert it into byte array and store it in the database in a column with a image datatype as a binary content.
FileStream oImg;
BinaryReader oBinaryReader;
byte[] oImgByteArray;
oImg = new FileStream(sFilePath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
oImgByteArray = oBinaryReader.ReadBytes((int)oImg.Length);
oBinaryReader.Close();
oImg.Close();
this is the code iam using.
when i use this its taking so much of time to get uploaded. so what i thought of doing is save the file in a specific folder using some postedfile.saveas(not sure of syntax) and when the user wants to view the file they can just download the file. i can do this by googling but what i want is wat abt the existing attachments in the database. so i need a help to do this........
is it possible to create a query to read the files and convert it into original file and save it in the specific folder or do i ve to create a simple interface to create do it manually , pls someone help me what to do ......
thanks in advance.
waiting for a reply soon
Note: any unclear statement in my question kindly reply me
Wishes n Regards
Venkat.
View 2 Replies
ADVERTISEMENT
Dec 3, 2007
Hi,
I have never use sql server to store binary data. Now, I need to store a .doc file into it. Which column type I should adopt?
In addition, could you provide me related articles to study?
Thanks,
Ricky.
View 3 Replies
View Related
Dec 10, 2001
Hi, guys,
I need something that can be used in a select statement to convert a int value to binary display format, for example:
5 would be displayed as 0101, etc...
Thanks
View 2 Replies
View Related
Jun 3, 2002
Hi,
I need to write Stored Procedures to convert a Binary number to a Decimal number and Decimal back to Binary (i.e. 2 sp's).
I don't have a clue how I'm to do this. Can anyone help me !?
Pieter
View 1 Replies
View Related
Feb 16, 2006
HI! :shocked:
I tried to convert 0x01C3F0F5012D36E0, binary(8) to datetime
But
How can I do that?
thanks for all
View 2 Replies
View Related
Jan 15, 2008
Hi Everyone -
iam facing a small problem i want to convert an output from the context_info() which is binary to string (or int)
example:
SET CONTEXT_INFO 3
select CONTEXT_INFO() --- it will return 0x0000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
the requested output is to be 3 again
thanx
Maylo
View 3 Replies
View Related
Apr 10, 2008
Does anybody know
how to convert in SQL a number from decimal to binary:
Example: 'F' = 1111
I tried select convert(binary, 12.22) but SQL interprets the word 'binary' as Hex.
Thanks a lot!
View 10 Replies
View Related
May 31, 2007
I need help converting a varchar field to binary.
I have a Data Control Task that has a OLE DB Source and corresponding OLE DB Destination Data Flow Task. In the referenced source table there exists a field defined as a varchar(12), in the corresponding destination table it is defined as a binary(12). How do I perform this conversion?
I tried inserting a Data Conversion Task and assigning the new data type as byte stream[DT_BYTES] and a Length = 12, but this was a bust. Output test is as follows:
Error: 0xC020901C at DFT - Windows, OLE_SRC - Windows [1]: There was an error with output column "Payload" (40) on output "OLE DB Source Output" (12). The column status returned was: "The value could not be converted because of a potential loss of data.".
Can anyone help me out here?
Regards,
View 1 Replies
View Related
Jan 20, 2007
Hi, I'm trying to do insert some data to the database through typing the a number in a textbox. But i will get this error message whenever i tried putting a number that will be inserted to the database.
Sorry that the codes are quite messy. Please do let me know which part of the coding contains the errors.
Please help me. Thanks.
Server Error in '/WSD Project - Cam-Mart' Application.
String or binary data would be truncated.The statement has been terminated. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated.The statement has been terminated.Source Error:
Line 26:
Line 27: Protected Sub add_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles add.Click
Line 28: SqlDataSource2.Insert()
Line 29: Response.Redirect("Checkout.aspx")
Line 30: Source File: C:Documents and SettingsAdministratorDesktopWSD Project - Cam-MartOrder.aspx.vb Line: 28 Stack Trace:
[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2300
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +147
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +413
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +115
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +392
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +405
System.Web.UI.WebControls.SqlDataSource.Insert() +13
Order.add_Click(Object sender, EventArgs e) in C:Documents and SettingsAdministratorDesktopWSD Project - Cam-MartOrder.aspx.vb:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +97
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
The codes that i have is in Order.aspx:
<%@ Page Language="VB" MasterPageFile="~/MainMasterPage.master" AutoEventWireup="false" CodeFile="Order.aspx.vb" Inherits="Order" title="Cam-Mart - Your Cart" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID="ProductID" runat="server" Visible="False"></asp:TextBox>
<asp:TextBox ID="ProductPrice" runat="server" Visible="False"></asp:TextBox><br />
<span style="font-family: Verdana; color: lightsteelblue;">Product Name: </span>
<asp:Label ID="prodName" runat="server" Text="Label" ForeColor="Black"></asp:Label><br />
<span style="font-family: Verdana; color: lightsteelblue;">Product Price: </span><asp:Label ID="price"
runat="server" Text="Label" ForeColor="Black"></asp:Label><br />
<span style="font-family: Verdana"><span style="color: lightsteelblue">Quantity:</span>
</span><asp:TextBox ID="tbQuantity" runat="server" AutoPostBack="True"></asp:TextBox>
<asp:Label ID="lblqty" runat="server" Text="Label"></asp:Label><br />
<asp:TextBox ID="ProductName" runat="server" Visible="False"></asp:TextBox><br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label><br />
<span style="color: lightsteelblue; font-family: Verdana">Your Order Date is: </span>
<asp:Label ID="lblOrderDate" runat="server"></asp:Label><br />
<span style="color: lightsteelblue; font-family: Verdana">Your Delivery Date will be:</span>
<asp:Label ID="lblDeliveryDate" runat="server"></asp:Label><br />
<asp:TextBox ID="dtorderdate" runat="server" Visible="False"></asp:TextBox>
<br />
<asp:TextBox ID="dtdeliverydate" runat="server" Visible="False"></asp:TextBox><br />
<br />
<asp:Button ID="add" runat="server" Text="Add to Cart" /><br />
<asp:Button ID="Back" runat="server" Text="Back" /><br />
<asp:Button ID="checkout" runat="server" Text="Checkout" /><br />
<asp:FormView ID="FormView1" runat="server" DataKeyNames="CustID" DataSourceID="SqlDataSource1">
<EditItemTemplate>
CustID:
<asp:Label ID="CustIDLabel1" runat="server" Text='<%# Eval("CustID") %>'></asp:Label><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update">
</asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTemplate>
<ItemTemplate>
CustID:
<asp:Label ID="CustIDLabel" runat="server" Text='<%# Eval("CustID") %>'></asp:Label><br />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:List Product %>"
SelectCommand="SELECT [CustID] FROM [CustInfo] WHERE ([CustName] = @CustName)">
<SelectParameters>
<asp:ControlParameter ControlID="Label1" Name="CustName" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:List Product %>" DeleteCommand="DELETE FROM [OrderDetail] WHERE [OrderID] = @original_OrderID AND [CustID] = @original_CustID AND [CustName] = @original_CustName AND [OrderDate] = @original_OrderDate AND [TotalValue] = @original_TotalValue AND [Quantity] = @original_Quantity AND [DeliveryDate] = @original_DeliveryDate AND [ProductID] = @original_ProductID AND [ProductName] = @original_ProductName"
InsertCommand="INSERT INTO [OrderDetail] ([CustID], [CustName], [OrderDate], [TotalValue], [Quantity], [DeliveryDate], [ProductID], [ProductName]) VALUES (@CustID, @CustName, @OrderDate, @TotalValue, @Quantity, @DeliveryDate, @ProductID, @ProductName)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [OrderDetail] WHERE ([CustID] = @CustID)"
UpdateCommand="UPDATE [OrderDetail] SET [CustID] = @CustID, [CustName] = @CustName, [OrderDate] = @OrderDate, [TotalValue] = @TotalValue, [Quantity] = @Quantity, [DeliveryDate] = @DeliveryDate, [ProductID] = @ProductID, [ProductName] = @ProductName WHERE [OrderID] = @original_OrderID AND [CustID] = @original_CustID AND [CustName] = @original_CustName AND [OrderDate] = @original_OrderDate AND [TotalValue] = @original_TotalValue AND [Quantity] = @original_Quantity AND [DeliveryDate] = @original_DeliveryDate AND [ProductID] = @original_ProductID AND [ProductName] = @original_ProductName">
<DeleteParameters>
<asp:Parameter Name="original_OrderID" Type="Int32" />
<asp:Parameter Name="original_CustID" Type="Int32" />
<asp:Parameter Name="original_CustName" Type="String" />
<asp:Parameter Name="original_OrderDate" Type="DateTime" />
<asp:Parameter Name="original_TotalValue" Type="Decimal" />
<asp:Parameter Name="original_Quantity" Type="Int32" />
<asp:Parameter Name="original_DeliveryDate" Type="DateTime" />
<asp:Parameter Name="original_ProductID" Type="Int32" />
<asp:Parameter Name="original_ProductName" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CustID" Type="Int32" />
<asp:Parameter Name="CustName" Type="String" />
<asp:Parameter Name="OrderDate" Type="DateTime" />
<asp:Parameter Name="TotalValue" Type="Decimal" />
<asp:Parameter Name="Quantity" Type="Int32" />
<asp:Parameter Name="DeliveryDate" Type="DateTime" />
<asp:Parameter Name="ProductID" Type="Int32" />
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="original_OrderID" Type="Int32" />
<asp:Parameter Name="original_CustID" Type="Int32" />
<asp:Parameter Name="original_CustName" Type="String" />
<asp:Parameter Name="original_OrderDate" Type="DateTime" />
<asp:Parameter Name="original_TotalValue" Type="Decimal" />
<asp:Parameter Name="original_Quantity" Type="Int32" />
<asp:Parameter Name="original_DeliveryDate" Type="DateTime" />
<asp:Parameter Name="original_ProductID" Type="Int32" />
<asp:Parameter Name="original_ProductName" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="FormView1" Name="CustID" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:ControlParameter Name="CustID" Type="Int32" ControlID="FormView1"/>
<asp:ControlParameter Name="OrderDate" Type="DateTime" ControlID="dtorderdate"/>
<asp:ControlParameter Name="TotalValue" Type="Decimal" ControlID="price"/>
<asp:ControlParameter Name="Quantity" Type="Int32" ControlID="lblqty"/>
<asp:ControlParameter Name="DeliveryDate" Type="DateTime" ControlID="dtdeliverydate"/>
<asp:ControlParameter Name="ProductID" Type="Int32" ControlID="ProductID"/>
<asp:ControlParameter Name="ProductName" Type="String" ControlID="prodName"/>
<asp:ControlParameter Name="CustName" Type="String" ControlID="Label1"/>
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>
The text in Order.aspx.vb is :
Partial Class Order
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Dim sUsername As String = " "
Session("Username") = Request.ServerVariables("Auth_user")
Label1.Text = Session("Username")
ProductID.Text = Request("ProductID")
ProductPrice.Text = Request("ProductPrice")
ProductName.Text = Request("ProductName")
lblqty.Text = tbQuantity.Text
prodName.Text = ProductName.Text
price.Text = ProductPrice.Text
dtorderdate.Text = DateTime.Today
dtdeliverydate.Text = DateAdd("d", 7, Date.Today)
lblOrderDate.Text = dtorderdate.Text
lblDeliveryDate.Text = dtdeliverydate.Text
'Dim dtorderdate, dtdeliverydate As DateTime
'lblOrderDate.Text = "Order date: " & dtorderdate.ToString
'lblDeliveryDate.Text = "Delivery date: " & dtdeliverydate.ToString
End Sub
Protected Sub add_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles add.Click
SqlDataSource2.Insert()
Response.Redirect("Checkout.aspx")
End Sub
Protected Sub Back_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Back.Click
Response.Redirect("Catalogs.aspx")
End Sub
Protected Sub checkout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkout.Click
Response.Redirect("Checkout.aspx")
End Sub
End Class
View 2 Replies
View Related
Feb 16, 2006
HI!!!:shocked:
Im trying to convert 0x00085180F0A2D511B69600508BE96424 to Integer or numeric format.
I just tried, At to many forms and combinations of that query
Help me !!!
SELECT CAST(CAST(CAST("field name " AS nvarchar) AS varbinary) AS float)
select cast(cast("field name " as varbinary)as integer)
select convert(int," field name") from FILE
select convert(varchar," field name") from FILE
The only answer that I have is
-1947638748 or ‘ ‘ or
And if I try with to many rows of the field at the same format,
It Answer me the same: -1947638748 for all the rows.
Thank`s for all
View 5 Replies
View Related
Jul 23, 2005
Hello,I'm trying to decifer the data in the table that stores the data in thebinary format. All numbers are placed in varbinary fields. All I know is theMS SQL 2000 database useing collation SQL_Latin1_General_CP1_CI_AS(default).For example the content of the field is:(0xB4F5000000000000) in unicode and defined as varbinary(8).Are there any procedures that convert the unicode binary (or hexa) numbersback to ascii or readable form?I tried as following but it didn't work.select cast(0xB4F5000000000000 as decimal(8,2))Any help is appreciated,Adam
View 1 Replies
View Related
Jul 23, 2005
There must be a way to convert the binarydata field in the SQL trace outputto text data when the event type is a show plan. SQL Profiler does it buthow can it be done from an imported table?Danny
View 6 Replies
View Related
Mar 31, 2008
hello all,
I am reading a file that contains textual data (formatted,e.g font=bold,font size=10 etc). After reading the file, i store the data read from the file to a table in Sql server 2005. But in the table, this data is stored like this:
daohORIGINAL TEXTm............
how can i just store the original text of the file in the table and get rid of these boxes? Or when i read this data from table, how to remove these boxes and get only the original text?
Thanks in advance.
I am using C# FileStream to read the file from disk. VS 2005
View 25 Replies
View Related
Jul 21, 2015
In Source, we have a column of datatype string(varchar/nvarchar).
Example:
col1
True
False
In Target we need to map the column which is of type binary. Binary column accepts only 1,0.
col1
1
0
how to achieve this? can this be done in derived column?
View 4 Replies
View Related
Mar 21, 2014
Code snippet for changing '00001001001' into a table value construct containing (64,8,1)?
View 6 Replies
View Related
Mar 8, 2007
I have been given some data from a Mainframe (AS400?) which has some fields coded in Packed Decimal. I have been able to load the data into a SQL2005 database table, but I now need to convert the Packed Decimal data in the binary(6) field to the appropriate integer (or float) value.
The field contains values such as the following:-
0x20202020200C
0x202020022025
0x20202020DFFA
I don't know how to interpret these. Has anyone got a function that can do this for me?
I've read several articles online that explain how packed decimal works, but none tell me how to interpret the last of my three examples. Can you help?
Thanks!
View 2 Replies
View Related
Feb 5, 2008
Hi ,
I am trying to convert a char field of lenght 5 into numeric (5,2) 999.99 format ,
i am getting an arithmentic overflow error.
The Character Data is 5 in length
It works fine if the Data is 00000
it fails if there is any number in the data
Like 10000
or 05000
How do i represent these into Numeric (5,2)
please let me know what taransformation to use and how.
Thanks,
View 2 Replies
View Related
Mar 12, 2008
select to_char(INITIAL_LOAD_DATE,'dd-mon-yyyy hh:mi:ss') from trans
View 14 Replies
View Related
Apr 9, 2007
I can't take full credit for this. I want to share this with Jeff Moden who did the important research for this calculation here.
All I did was just adapting some old code according to the mantissa finding Jeff made and optimized it a little
Some test codeDECLARE@SomeNumber FLOAT,
@BinFloat BINARY(8)
SELECT@SomeNumber = -185.6125,
@BinFloat = CAST(@SomeNumber AS BINARY(8))
SELECT@SomeNumber AS [Original],
CAST(@SomeNumber AS BINARY(8)) AS [Binary],
dbo.fnBinaryFloat2Float(CAST(@SomeNumber AS BINARY(8))) AS [Converted],
@SomeNumber - dbo.fnBinaryFloat2Float(CAST(@SomeNumber AS BINARY(8))) AS [Error]
And here is the code for the function.CREATE FUNCTION dbo.fnBinaryFloat2Float
(
@BinaryFloat BINARY(8)
)
RETURNS FLOAT
AS
BEGIN
DECLARE@Part TINYINT,
@PartValue TINYINT,
@Mask TINYINT,
@Mantissa FLOAT,
@Exponent SMALLINT,
@Bit TINYINT,
@Ln2 FLOAT,
@BigValue BIGINT
SELECT@Part = 1,
@Mantissa = 1,
@Bit = 1,
@Ln2 = LOG(2),
@BigValue = CAST(@BinaryFloat AS BIGINT),
@Exponent = (@BigValue & 0x7ff0000000000000) / EXP(52 * @Ln2)
WHILE @Part <= 8
BEGIN
SELECT@Part = @Part + 1,
@PartValue = CAST(SUBSTRING(@BinaryFloat, @Part, 1) AS TINYINT),
@Mask =CASE WHEN @Part = 2 THEN 8 ELSE 128 END
WHILE @Mask > 0
BEGIN
IF @PartValue & @Mask > 0
SET @Mantissa = @Mantissa + EXP(-@Bit * @Ln2)
SELECT@Bit = @Bit + 1,
@Mask = @Mask / 2
END
END
RETURNSIGN(@BigValue) * @Mantissa * POWER(CAST(2 AS FLOAT), @Exponent - 1023)
END
Thanks again Jeff!
Peter Larsson
Helsingborg, Sweden
View 3 Replies
View Related
May 22, 2014
Server is SQL 2000
I have a table with 10 rows with a varbinary column
I wish to concatenate all the binary column into a single binary column and then write that to another table within the database. This application splits a binary file (Word or PDF document) into multiple segments (this is Column2 as below)
example as follows
TableA
Column1 Column2 Column3
aaa 001 <some binary value>
aaa 002 <some binary value>
aaa 003 <some binary value>
aaa 004 <some binary value>
aaa 005 <some binary value>
desired results in TableB
Column1 Column2
aaa <concatenated value of above binary columns>
View 9 Replies
View Related
May 7, 2015
I'm using a bit-wise comparison to effectively store multiple values in one column. However once the number of values increases it starts to become too big for a int data type.you also cannot perform a bitwise & on two binary datatypes. Is there a better way to store the binary data rather than int or binary?
View 9 Replies
View Related
Sep 28, 2007
Using DTS package in 2000 version, I am dumping TXT file contents into SQL Table,
I have one column having date in format YYYYMMDD(20070929) and corresponding column in SQL is datetime, but it fails on data type mismatch.
I have no choice of making date column in SQL to string or Varchar etc,
is there any way to make that date column in SQL to convert the value upon transformation from format (YYYYMMDD) to M/DD/YYYY (9/29/2007).
many many thanks,
View 2 Replies
View Related
Apr 29, 2008
Hi,
I receive blanks for a column called value and i need to represent it as a blank or NA into a colum whose datatype is float in the datawarehouse.
how is this possible because in current schenario a blank is being converted to 0
which is not the right thing.
i would like to retain the blank in conversion from char to float ,
please explain me if it can be done or how to overcome this issue.
Thanks
View 1 Replies
View Related
Aug 15, 2006
Dear Experts,Ok, I hate to ask such a seemingly dumb question, but I'vealready spent far too much time on this. More that Iwould care to admit.In Sql server, how do I simply change a character into a number??????In Oracle, it is:select to_number(20.55)from dualTO_NUMBER(20.55)----------------20.55And we are on with our lives.In sql server, using the Northwinds database:SELECTr.regionid,STR(r.regionid,7,2) as a_string,CONVERT(numeric, STR(r.regionid,7,2)) as a_number,cast ( STR(r.regionid) as int ) as cast_to_numberFROM REGION R1 1.00112 2.00223 3.00334 4.0044SELECTr.regionid,STR(r.regionid,7,2) as a_string,CONVERT(numeric, STR(r.regionid,7,2) ) as a_number,cast (STR(r.regionid,7,2) as numeric ) as cast_to_numberFROM REGION R1 1.00112 2.00223 3.00334 4.0044Str converts from number to string in one motion.Isn't there a simple function in Sql Server to convertfrom string to number?What is the secret?Thanks
View 4 Replies
View Related
Apr 2, 2008
I want to create the most effective way (google) to have content displayed on a web page.
Currently, we are updating to SQL and populating to web via calling SQL statements hardcoded to page. I want to know if this is ok to do, or should we be reading from a static XML file that is updated?
I think the XML is the way to go being that i may have answered my own question, but i was curious to what the experts on asp.net had to say.
Thanks,Nick
View 9 Replies
View Related
Mar 9, 2007
an outside developer has sent us a mdf file that contains the need updates to a database.
here is where the problem comes in, how can i append the contents of the mdf file to an existing db?
there are about a dozen tables, 50 stored procs, and one new user.
View 2 Replies
View Related
Aug 22, 2006
Hi everyone,
I'm just using TEXTBOX control to save data into my DB. My question is, if I have multiple lines of sentences, it does not store as what it looks like. For example;
Hello, Mike
It stores into the database as "Hello, Mike" and if I read from the database, it does not have seperate lines and shows it like this;
Hello, Mike
How can I store the contents into database and make the contents as original? (Sorry for the poor English, but I hope you understand it.)
View 2 Replies
View Related
Jun 21, 2007
Hi All,I have a job coming up which involves me creating a vacancy system for our website.I (think) I'll only need one table:ID (PK)JobTitleJobLocationSalaryHoursJobDescriptionValidFrom (Date/Time)ValidTo (Date/Time)I'll display this data using a C#.Net repeater but I was wondering how I can automatically strip the page of the jobs that have gone past their expiry date? Is is straightforward to achieve?Thanks in advance,Brett
View 2 Replies
View Related
Jan 14, 2008
HiI have developed a sql procedure for updating some xml content using SQL 2005 xQuery features.For example:Declare @xmlContent = '<books><book name="asp"/>< book name = "sql"/></books>'--Now I want to add attribute "book_id" to the xml content.SET @xmlContent.modify('insert attribute book_id{"1" } into (/books/book[@name="asp"])[1] ')SET @xmlContent.modify('insert attribute book_id{"2" } into (/books/book[@name="sql"])[1] ')SELECT @xmlContent--OUTPUT will be<books><book name="asp" book_id="1"/><book name="sql" book_id="2"/></books>QUESTIONQ1. Do we have any extension or plugin such that this SQl 2005 xquery feature can be incorporated in SQL 2000?Q2. If the answer for Q1. is no (as I expect), then do we have any TSQL feature in SQL 2000 for modifying xml content?I found all examples in SQl 2000 related with "openxml" function which performs the select kind of operations only. Like selecting data in XML format OR converting xml data in to tabular format. But I couldn't find any xml modification TSQL in SQl 2000 which can add element/attributes or change values.one workaround could be to consider xml content as string and use string functions to modify the content.But is there any more sensible approach available in SQL 2000?
View 1 Replies
View Related
Dec 29, 2003
Okay, moving to developing a small site that will be storing articles - that is a site largely consisting of html marked up articles with images. We already have an SQL Server so it is becoming the back-end.
So, since I'm not an SQL Server expert, some general advice on this would be appreciated? The articles, as I say in HTML (largely just markup for titles, and general text) would be stored in the DB? As Text datatypes?
How about the images...on disk or in SQL?
View 3 Replies
View Related
Nov 12, 2001
hi everybody,
The problem is, I have a table with one column of varchar(8000) datatype. It has got 1000's of records. Through Query Analyzer, I am not able to view my records after 257 columns in my table, even I increased my textsize by using 'set textsize' command.
Any other setting is available to correct this. Any help is appreciated.
thanks,
Vasu
View 2 Replies
View Related
Sep 10, 2001
I have a particular production database that on a few recent occasions has suddenly had one of it's tables empty of content. Now there are no jobs or triggers in place neither is any stored procedures that could perform a delete or alter table operation in place. The permissions have been set not to allow this either. The datatype is text only. What is intriguing is the QA server has an exact mirror and this dosen't happen. Has anyone come across this sort of phenomenon?
View 2 Replies
View Related
Feb 24, 2000
Hello,
I have a field in a table called 'CourseId' - the course Id should always contain a backslash somewhere in the list of numbers eg :
12342322
11231131
Unfortunately, some of the course Ids have a forward slash instead of a backslash eg :
462322/1
23/232323
How can I update the field to replace the / with a
Any help is very much appreciated.
Thanks in advance,
Anthony
View 1 Replies
View Related