Newline in SQL database

I want to store a newline character in my varchar type in a SQL db, so that in an HTML TEXTAREA box with WRAp="HARD", I want the newline to cause remaining text to be outputted on a new line in the TEXTAREA.
Using "\n" or "\\n" doesn't do it.
Help
Thanks

You should check for special characters anyways, such as...
<, >, &, "
These may mess up your html also.

Similar Messages

  • Image path not storing in sql database

    Hello,
    I have read here on the forum how to upload an image to server and store path in  your database, the image uploads correctly to the correct folder on my server but the image path does not get stored on my sql database (not local hosting). I receive the error: The file has been uploaded, and your information has been added to the directory. Column 'image' cannot be null.
    My database has the following columns:
    id
    datum
    image
    sectie
    My code is as follows:
    <?php require_once('Connections/dbTroch.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_dbTroch, $dbTroch);
    $query_rs_aanbod = "SELECT * FROM tblSlideshow ORDER BY id ASC";
    $rs_aanbod = mysql_query($query_rs_aanbod, $dbTroch) or die(mysql_error());
    $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    $totalRows_rs_aanbod = mysql_num_rows($rs_aanbod);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    $target = "images/slides/";  //This is the directory where images will be saved// 
    $target = $target . basename( $_FILES['image']['name']); //change the image and name to whatever your database fields are called//
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add-photos-aanbod")) {
      $insertSQL = sprintf("INSERT INTO tblSlideshow (image, sectie) VALUES (%s, %s)",
                           GetSQLValueString($_POST['file'], "text"),
                           GetSQLValueString($_FILES['image']['name'], "text"));
    //This code writes the photo to the server//
    if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
    //And confirms it has worked//
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
    else {
    //Gives error if not correct//
    echo "Sorry, there was a problem uploading your file.";
      mysql_select_db($database_dbTroch, $dbTroch);
      $Result1 = mysql_query($insertSQL, $dbTroch) or die(mysql_error());
    ?>
    <!doctype html>
    <html>
    <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Troch Project Solutions - Admin - Toevoegen</title>
      <link rel="stylesheet" href="css/foundation.css" />
      <link rel="stylesheet" href="css/layout.css" />
      <!-- Fonts
      ================================================== -->
      <script type="text/javascript" src="//use.typekit.net/vob8gxg.js"></script>
      <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
      <!-- jQuery
      ================================================== -->
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
      <script src="js/vendor/modernizr.js"></script>
    </head>
    <body>
        <div class="row">
          <div class="large-8 medium-8 small-8 large-centered medium-centered small-centered columns intro">
              <h2 class="subheader text-center">Admin</h2>
              <p><a>Log uit</a></p>
              <p><a href="admin.php">Terug naar Admin menu</a>
              <h4>image toevoegen naar aanbod slideshows:</h4>
              <form action="<?php echo $row_rs_aanbod['']; ?>" method="POST" name="add-photos-aanbod" id="add-photos-aanbod" enctype="multipart/form-data">
              <table>
                    <tbody>
                         <tr>
                              <td><label for="image">Kies foto:</label></td>
                              <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
                        <tr>
                              <td>Sectie:</td>
                              <td><select name="sectie" id="sectie" option value="sectie">
                                <?php
    do { 
    ?>
                                <option value="<?php echo $row_rs_aanbod['sectie']?>"><?php echo $row_rs_aanbod['sectie']?></option>
                                <?php
    } while ($row_rs_aanbod = mysql_fetch_assoc($rs_aanbod));
      $rows = mysql_num_rows($rs_aanbod);
      if($rows > 0) {
          mysql_data_seek($rs_aanbod, 0);
          $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    ?>
                              </select></td> 
                        </tr>
                        <tr>
                            <td><input type="Submit" name="Add" id="add" value="Toevoegen" /></td>
                        </tr>
                </tbody>
            </table>
            <input type="hidden" name="MM_insert" value="add-photos-aanbod" />
        </form>
          </div><!-- end large-8 -->
        </div><!-- end row -->
    <script src="js/vendor/jquery.js"></script>
    <script src="/js/vendor/fastclick.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
                $(document).foundation();
            </script>
    </body>
    </html>
    <?php
    mysql_free_result($rs_aanbod);
    ?>
    I cannot work out what is wrong and I would appreciate any help on this. Thanks

    Your form field and array variable names do not match
    <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
    GetSQLValueString($_POST['file'], "text"),

  • Intermittant (not constant) SQL database ShareWebDb login failed events 3760 and 2424

    My Sharepoint 3.0 services that were bundled with SBS 2008 appear to be working fine. Companyweb, etc, all work w/o issue, so I don't want to take violent action, but these errors seem to be accellerating so I would love to know if there is a known
    solution.
    I typically receive the following (these are in reverse time order, latest at the top, just as they appear in the event log):
    Error Event ID: 3760 SQL Database 'ShareWebDb' on SQL Server instance 'np:\\.\pipe\MSSQL$Microsoft##SSEE\sql\query' not found. Additional error information from SQL Server is included below. Cannot open database "ShareWebDb" requested
    by the login. The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
    one second earlier:Error Event ID: 2424 The update cannot be started because the content sources cannot be accessed. Fix the errors and try the update again. Context: Application 'Search', Catalog 'index file
    on the search server Search'
    Information Event ID: 18456 No description, here is the Details:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider
    Name="MSSQL$MICROSOFT##SSEE" />
    <EventID Qualifiers="49152">18456</EventID>
    <Level>0</Level>
    <Task>4</Task>
    <Keywords>0x90000000000000</Keywords>
    <TimeCreated
    SystemTime="2010-11-12T18:35:06.000Z" />
    <EventRecordID>491461</EventRecordID>
    <Channel>Application</Channel>
    <Computer>myserver.mydomain.local</Computer>
    <Security
    UserID="S-1-5-20" />
    </System>
    <EventData>
    <Data>NT AUTHORITY\NETWORK SERVICE</Data>
    <Data>[CLIENT: <named pipe>]</Data>
    <Binary>184800000E000000170000005000450054003300310030005C004D004900430052004F0053004F00460054002300230053005300450045000000070000006D00610073007400650072000000</Binary>
    </EventData>
    </Event>
    Two seconds earlier
    Information Event ID 17137 No description, here is the Details:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider
    Name="MSSQL$MICROSOFT##SSEE" />
    <EventID Qualifiers="16384">17137</EventID>
    <Level>4</Level>
    <Task>2</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated
    SystemTime="2010-11-12T18:35:04.000Z" />
    <EventRecordID>491460</EventRecordID>
    <Channel>Application</Channel>
    <Computer>mysever.mydomain.local</Computer>
    <Security
    UserID="S-1-5-20" />
    </System>
    <EventData>
    <Data>ShareWebDb</Data>
    <Binary>F14200000A000000170000005000450054003300310030005C004D004900430052004F0053004F00460054002300230053005300450045000000070000006D00610073007400650072000000</Binary>
    </EventData>
    </Event>
    I get more 3760 errors than 2424's. However, the
    2424's do seem to usually correspond to a 3760 18456 17137 occurance and the
    3760 are always preceeded by 18456 17137. I was getting one or two sets a day, lately that has increased to 5 or 10.
    I've done a lot of
    web research on Sharepoint Errors 3760 and
    2424 and I see a number of people are experiencing the the same issue. Most of what I've come across for solutions do not apply, since errors are intermittent, not chronic and my public remote URL has already been added
    to BackConnectionHostNames as per:
    http://blogs.technet.com/b/sbs/archive/2009/08/05/sharepoint-services-3-search-event-errors-after-an-sbs-2008-update-rollup.aspx
    I installed the SQL Server Management Studio Express so I could try to track down the permissions on this database. I see the SQL server instance, MYSERVER\Microsoft##ssee, and it shows as running, but when I try to connect to it I get the following
    error: "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote
    connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)" I'm assuming that is because I don't have access permission for that internal database.
    I don't see any errors in the event log related to failed logins or any errors at all from the SQL server, but there are the time matching informational entries right before the error events and lots of other 17137's and 2803's from MSSQL$Microsoft##ssee

    Thank you Kevin, that does seem to match my symptoms and I have made the change suggested. Just incase that page becomes unreachable by others, here is the part of the page that applies to this:
    Issue:
    =========
    Receive event error 3760 and 6398 on SBS 2008
    Cause:
    ==========
    Issue was caused by incorrect Auto Close option for ShareWebDb database
    Solution:
    ==========
    1. On the SBS 2008 server, click Start -> All Programs -> Microsoft SQL Server 2005, right click SQL Server Management Studio Express and choose run as administrator.
    NOTE: You must run it as administrator to perform steps below.
    2. In the Server Name box, type \\.\pipe\MSSQL$Microsoft##SSEE\sql\query, click connect.
    3. Expand Database node and right click the ShareWebDb then choose properties.
    4. Click Options in the left pane, in the right pane, please check whether the Auto Close option is set to True, if so, please change it to False.

  • I need to host a website with a SQL database - Azure pricing details are too confusing

    Hello,
    I need to give a potential client a hosting price for a somewhat simple web application they want me to build. I told them it shouldn't be a problem. After gathering the requirements, I figured I would use the following technology to build and host
    it:
    ASP.NET 4.5
    MVC 5
    1 SQL Database ~ 25GB with options to expand and also with a backup
    SSL certificate needed
    Hosting would be on Azure because I have some experience using Visual Studio 2012 and integrating the Visual Studio Online (TFS) source code and scrum web applications. I've never actually spun up a website with a SQL database using Azure before, but I
    imagined it wasn't too difficult to find a general hosting plan to support the above requirements.
    The use of the website will be very simple and limited to the basic CRUD operations. Will support forms authentication using the Identity 2.0 framework. The web applications main purpose is to fill out a form for new accounts, have a search page for
    those accounts, a page to view a created account and add notes to it. So performance wise, it isn't asking for much. I just want it to be fast and secure.
    So I start looking on the Azure's pricing landing page which is here: (can't put links in here, but search Azure pricing on Bing) and I see this Pricing Calculator, so I click it
    First thing I notice is the Websites tab doesn't mention SQL Database - in fact the Data Management is a separate tab from Websites. And if I made my selections on the Websites tab, the estimated monthly price doesn't stay the same when I go to the Data
    Management tab - so I get the illusion I have to have two separate purchases.
    I'm not exactly sure if the Pay as You Go billing feature would be okay because it's just a bit scary to leave every monthly payment up to chance; somewhat. Would love to know if there is other payment options that I could see for what I described above.
    I want to use Azure to host my asp.net website - it makes sense and the integration with Visual Studio is amazing. I love the publish feature for both MVC 5 Projects and SQL Database Projects.
    Thanks in advance for the help!

    Hello jdevanderson,
    I suggest that you start by looking at the pricing TIERS for the Azure website. This link will give you clarity on different Service TIERS that are availaible:
    http://azure.microsoft.com/en-in/pricing/details/websites/
    You can guage your requirement and choose the Service TIER accordingly.
    And regarding the database, you are right about it. You will be charged seperately for the database. You can refer to this link that will give you clarity on SQL database pricing:
    http://azure.microsoft.com/en-in/pricing/details/sql-database/
    Refer to this link for more information on 'How pricing works':
    http://azure.microsoft.com/en-in/pricing/
    Use the full calculator to add your website and the database to get an estimated cost:
    http://azure.microsoft.com/en-in/pricing/calculator/?scenario=full
    Thanks,
    Syed Irfan Hussain

  • Advise on SQL database process

    Dear all,
    We have build our own product CMS platform configuration which is running on SQL server and CMS web site link to it.
    We will lauch our product soon but need to identify the correct hosting plan for not having any further issue.
    For exemple for now all is hosted in our company azure account with a Standard Basic 5 DTU's.
    When we go in production we can expect some connection and big amount of data on our database.
    My question are as follow :
    - Does using a single database storage for my potential Customers would be enough ?
    - How should I plan backup efficiently ?
    - Should I plan a safety replication process somewhere in azure or duplicate the storage in order to switch in case of lack of place ?
    My concern is to avoid my database beeing full while customers increase
    Thanks for your advise and help
    regards
    serge

    Hi Solatys,
    - If I select by default STANDARD Azure database, which size, DTU, etc should I select ? 
    For this question, you may reference the below link. You can scale your Azure database performance based on the real-time requirement.
    Azure
    SQL Database introduces new near real-time performance metrics 
    - If for instance the initial URL of the web portal connected to SQL server1 has a trouble, how can I switch users transparently to a second replicated server in order that user will notify anything ?
    Azure SQL Database has a built-in high availability subsystem that protects your database from failures of individual servers and devices in a datacenter. Azure SQL
    Database maintains multiple copies of all data in different physical nodes located across fully independent physical sub-systems to mitigate outages due to failures of individual server components, such as hard drives, network interface adapters, or even entire
    servers. At any one time, three database replicas are running—one primary replica and two or more
    secondary replicas. Data is written to the primary and one secondary replica using a quorum based commit scheme before the transaction is considered committed.
    If the hardware fails on the primary replica, Azure SQL Database detects the failure and fails over to the secondary replica. In case of a physical loss of a replica, a new replica is automatically created.
    So there are always at minimum two physical, transactionally consistent copies of your data in the datacenter.
    Azure SQL Database Business Continuity
    - IF I select the Maximum size of the database, what will happen in case it will be nearly full and need to provide more space ?
    Insert and update transactions that exceed the upper limit will be rejected because the database will be in read-only mode. The maximum size has been gained from 50GB to 500GB as of now, you may have no concern about it. You can
    set a monitoring alertto
    notify the storage utilization and CPU percentage etc.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Merge to Insert or update records in SQL Database

    Hello ,
    I am having hard time with creating a Stored Procedure to insert/update the selected records from Oracle data base to SQL database using BizTalk.
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
    @dp_id char(32),
    @dv_id char(32),
    @em_number char(12),
    @email varchar(50),
    @emergency_relation char(32),
    @option1 char(16),
    @status char(20),
    @em_id char(35),
    @em_title varchar(64),
    @date_hired datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    MERGE [dbo].[em] AS [Targ]
    USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
    AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
    ON [Targ].em_id = [Sourc].em_id
    WHEN MATCHED THEN
    UPDATE SET dp_id = [Sourc].dp_id,
    dv_id = [Sourc].dv_id,
    em_number = [Sourc].em_number,
    email = [Sourc].email,
    emergency_relation = [Sourc].emergency_relation,
    option1 = [Sourc].option1,
    status = [Sourc].status,
    em_title = [Sourc].em_title,
    date_hired = [Sourc].date_hired
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
    VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
    END;
    I am getting an error like
    WcfSendPort_SqlAdapterBinding_
    TypedProcedures_dbo_Custom" with URL "mssql://abc//def?". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.Data.SqlClient.SqlException (0x80131904): Procedure or function 'uspInsertorUpdateINF'
    expects parameter '@dp_id', which was not supplied
    I cannot give the Oracle Database name directly in the stored Procedure
    I am stuck with this, and cannot figure out since I am new to SQL Queries and Stored Procedures. Any help is greatly appreciated.
    Thanks

    Hi sid_siv,
    Only the first record is inserted because of the scalar variables of the stored procedure(SP), when you call the SP, only one row is passed. To get all rows inserted, you can either declare a
    table-valued parameter
    (TVP) for the SP or using an Oracle linked server in the SP.
    Create a stored procedure with a table-valued parameter
    As you mentioned linked server is not good in your case, then TVP SP can be the only option. Regarding how to call a SP with TVP parameter in BizTalk, that's a typically BizTalk question then. I would suggest you post your question in a dedicated
    BizTalk Server forum. It is more appropriate and more experts will assist you.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Check for duplicate record in SQL database before doing INSERT

    Hey guys,
           This is part powershell app doing a SQL insert. BUt my question really relates to the SQL insert. I need to do a check of the database PRIOR to doing the insert to check for duplicate records and if it exists then that record needs
    to be overwritten. I'm not sure how to accomplish this task. My back end is a SQL 2000 Server. I'm piping the data into my insert statement from a powershell FileSystemWatcher app. In my scenario here if the file dumped into a directory starts with I it gets
    written to a SQL database otherwise it gets written to an Access Table. I know silly, but thats the environment im in. haha.
    Any help is appreciated.
    Thanks in Advance
    Rich T.
    #### DEFINE WATCH FOLDERS AND DEFAULT FILE EXTENSION TO WATCH FOR ####
                $cofa_folder = '\\cpsfs001\Data_pvs\TestCofA'
                $bulk_folder = '\\cpsfs001\PVS\Subsidiary\Nolwood\McWood\POD'
                $filter = '*.tif'
                $cofa = New-Object IO.FileSystemWatcher $cofa_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
                $bulk = New-Object IO.FileSystemWatcher $bulk_folder, $filter -Property @{ IncludeSubdirectories = $false; EnableRaisingEvents= $true; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' }
    #### CERTIFICATE OF ANALYSIS AND PACKAGE SHIPPER PROCESSING ####
                Register-ObjectEvent $cofa Created -SourceIdentifier COFA/PACKAGE -Action {
           $name = $Event.SourceEventArgs.Name
           $changeType = $Event.SourceEventArgs.ChangeType
           $timeStamp = $Event.TimeGenerated
    #### CERTIFICATE OF ANALYSIS PROCESS BEGINS ####
                $test=$name.StartsWith("I")
         if ($test -eq $true) {
                $pos = $name.IndexOf(".")
           $left=$name.substring(0,$pos)
           $pos = $left.IndexOf("L")
           $tempItem=$left.substring(0,$pos)
           $lot = $left.Substring($pos + 1)
           $item=$tempItem.Substring(1)
                Write-Host "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp"  -fore green
                Out-File -FilePath c:\OutputLogs\CofA.csv -Append -InputObject "in_item_key $item in_lot_key $lot imgfilename $name in_cofa_crtdt $timestamp"
                start-sleep -s 5
                $conn = New-Object System.Data.SqlClient.SqlConnection("Data Source=PVSNTDB33; Initial Catalog=adagecopy_daily; Integrated Security=TRUE")
                $conn.Open()
                $insert_stmt = "INSERT INTO in_cofa_pvs (in_item_key, in_lot_key, imgfileName, in_cofa_crtdt) VALUES ('$item','$lot','$name','$timestamp')"
                $cmd = $conn.CreateCommand()
                $cmd.CommandText = $insert_stmt
                $cmd.ExecuteNonQuery()
                $conn.Close()
    #### PACKAGE SHIPPER PROCESS BEGINS ####
              elseif ($test -eq $false) {
                $pos = $name.IndexOf(".")
           $left=$name.substring(0,$pos)
           $pos = $left.IndexOf("O")
           $tempItem=$left.substring(0,$pos)
           $order = $left.Substring($pos + 1)
           $shipid=$tempItem.Substring(1)
                Write-Host "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp"  -fore green
                Out-File -FilePath c:\OutputLogs\PackageShipper.csv -Append -InputObject "so_hdr_key $order so_ship_key $shipid imgfilename $name in_cofa_crtdt $timestamp"
    Rich Thompson

    Hi
    Since SQL Server 2000 has been out of support, I recommend you to upgrade the SQL Server 2000 to a higher version, such as SQL Server 2005 or SQL Server 2008.
    According to your description, you can try the following methods to check duplicate record in SQL Server.
    1. You can use
    RAISERROR to check the duplicate record, if exists then RAISERROR unless insert accordingly, code block is given below:
    IF EXISTS (SELECT 1 FROM TableName AS t
    WHERE t.Column1 = @ Column1
    AND t.Column2 = @ Column2)
    BEGIN
    RAISERROR(‘Duplicate records’,18,1)
    END
    ELSE
    BEGIN
    INSERT INTO TableName (Column1, Column2, Column3)
    SELECT @ Column1, @ Column2, @ Column3
    END
    2. Also you can create UNIQUE INDEX or UNIQUE CONSTRAINT on the column of a table, when you try to INSERT a value that conflicts with the INDEX/CONSTRAINT, an exception will be thrown. 
    Add the unique index:
    CREATE UNIQUE INDEX Unique_Index_name ON TableName(ColumnName)
    Add the unique constraint:
    ALTER TABLE TableName
    ADD CONSTRAINT Unique_Contraint_Name
    UNIQUE (ColumnName)
    Thanks
    Lydia Zhang

  • Error upon inserting data in sql Database using stream analytics job: Datatye error conversion

    I have a data passed into the Event Hubs, queried by stream analytic job inserting it into sql database. Upon running the job, it becomes idle a few seconds after since it has an error:
    Message: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64. Exception message at level [1], exception number [0], parent exception number [0]: Conversion from 0 to System.Boolean failed. 0 was of type - System.Int64.
    The data type in one of my field(IsHistorical) is Boolean with a value of false. The data type of the column in the sql table where this is to be inserted is of type bit. In this case, it seems that stream analytics could not convert the value "false"
    into a bit data type when inserting in sql table.
    I'm wondering if you already have encountered this problem. Could you help me resolve this problem?
    Thank you.

    Azure Stream Analytics does not have Boolean type. On input we will convert JSON Boolean value to bigint.
    Here is the list of supported types and conversions:
    https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx 
    You  can fix this erro by changing column type from bit to int in SQL table schema.

  • UUT Result log in SQL database?

    Hello All
    I am facing a requirement where i want to log results of sequence execution[only the complete seq result and NOT step results] to SQL database BUT as and when the UUT_ID varies the entry should be made into a new column with the same name as UUT_ID. As of now whenever i execute a sequence with different UUT_ID, a new row gets added as a result.
    Please reply back with your suggestions asap, as this very urgent for me :-)
    Regards
    Nitin Goel

    But in my opinion, that's just a way to display the results - not a way to store the data. I also have thousands of test cases and tens of thousands of different UUT each month. Each UUT has a separate record (a unique row) and yet if I design a proper query and report format, I can show the results exactly like you have. The design of a relational database should not be the same as a report design, imho.
    A database is designed to have unlimited rows (dependent only on storage space). I'm not sure a db can have unlimited columns. That would be something you could check with your dba. Dynamically adding a new column and doing an update to an existing row would probaby be much slower than just doing an insert.

  • Updating array data in sql database

    HI,
    Im facing problems in updating array data in SQL database.
    As of now, i am able to write an "insert" query and insert array data in an image datatype field. Im using image datatype because the array size is very big(around 80,000 x and y values).
    Althoug inserting data is easy im unable to write a query to update this data.
    Referring to the help of SQL server and Labview database connectivity toolkit, i came across a method of accessing image datatype....using textpointers, which are 16 bit binary values and using the WRITETEXT function instead of the UPDATE function.
    but the problem im facing is that ive to pass the array as a 2d string array in the query as a result the updated array is retrieved in the form of a string a
    nd not as an array. how do I get over this problem?

    Hi Pavitra,
    I'm not very clear on how you have inserted the data into your application, but I do know that when you call the UPDATETEXT or WRITETEXT function you use the TEXTPOINTERS to point to the first location of a 1d array. So, depending on how you've stored the data, you may have problems updating your data if you're looking at it as a 1d array instead of how you originally formatted it. If you are able to successfully access the data as a 1d array, you can use the database variant to data type vi and pass in a string array constant for the data type. This will convert the variant datatype into whatever you specify. You may have to index the row and column of the variant (you receive a 2d array of variant) first before you convert. If possible, can yo
    u provide some more detail and maybe some example code of how you perform the insert and plan to do the update? I can probably give you a better solution if I know how you are formatting the data. Thanks!
    Jeremy L.
    National Instruments
    Jeremy L.
    National Instruments

  • Data Search In SQL Database

    Hi, i want user to type a string in textbox, and i will search, if textbox.text exists in my SQL database table or not. Below is the code i'm using :---------------
     string txtname = (txtEmpName.Text).Trim();
     sQuery = "select * from tbUser where UserName='_username'";
     sQuery = sQuery.Replace("_username", txtname);
     SqlConnection objConnection = new SqlConnection(source);
     objDataAdapter = new SqlDataAdapter(sQuery,objConnection);
    // DataTable dtTable = new DataTable();
     if (objConnection.State  == ConnectionState.Closed)
     objConnection.Open();
     objDataSet = new DataSet();
     objDataAdapter.Fill(objDataSet);
    // objDataAdapter.Fill(dtTable);
    or i want to search if "txtname" exists in "tbUser" table.
    Thanks & Regards.
    Manish S. Anand

    This is a very poor coding, Unfortunately not fit anywhere :-(
    This code is a security risk (sql injection)!
    He should use SqlCommand class with parameters!
    but yet if i understand the problem he is facing, then the problem is in the SQL part of the code and not the Dot.net :-) therefor it is fit to this forum. Basically the code should work, but as i understand from him his problem is in the
    result set come back from the query filter. If so:
    * the problem is that he use:
    where UserName='_username'
    instead of:
    where UserName='%_username%'
    and he do ask about the search problem :-)
    [Personal Site] [Blog] [Facebook]

  • Database Initialiser does not create azure sql database

    I have a WPF application In the OnStartup in the app.cs I set the Database initializer and forced the context the initialise my database:
    Debug.WriteLine("Setting Initializer");
    Database.SetInitializer<MyContext>(new MyDatabaseInitializer());
    Debug.WriteLine("Declaring new context");
    using (MyContext c = new MyContext("MyContext"))
    Debug.WriteLine("Force the initialization");
    c.Database.Initialize(true);
    Debug.WriteLine("Done!");
    I created a sql database in the management portal of the azure.
    Copied the connectionstring it provided for ADO.net.
    But my database is not created.
    I also added a firewall rule but nothing happens. I Have no clue what to do.
    Can anybody please help me with this?
    If you need more information please ask i really have to get this sorted out.
    Thanks in advance!

    Hi Turkstra,
    I have tried to use EF to create Azure SQL database, it works as expect, the database 'jambordbcreate' appear in my SQL Azure, below is the detailed codes.
    using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace CodeFirst
    class Program
    static void Main(string[] args)
    Database.SetInitializer(
    new CreateDatabaseIfNotExists<SchContext>());
    using (var db = new SchContext("Server=tcp:****.database.windows.net,1433;Database=jambordbcreate;User ID=vote@***;Password=***;Trusted_Connection=False;Encrypt=True;Connection Timeout=30"))
    string name = "jambor";
    var student=new Student(){Name=name, ID="1a"};
    db.Students.Add(student);
    db.SaveChanges();
    db.Database.Initialize(true);
    public class Student
    public string ID { get; set; }
    public string Name { get; set; }
    public string age { get; set; }
    public string sex { get; set; }
    public class School
    public string ID { get; set; }
    public string Name { get; set; }
    public virtual List<Student> Students { get; set; }
    public class SchContext : DbContext
    public SchContext(string connection):base(connection)
    public DbSet<Student> Students { get; set; }
    public DbSet<School> Schools { get; set; }
    I suggest  you check your SQL connection, after run your code, please refresh azure portal to see whether your database is exist. Hope this give you some help.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Storing WORD or PDF files in SQL database

    Can WORD document or PDF documents be stored in SQL database?
    If so, how? I would like an example (if possible).
    I do realize that I can store a reference pointer that points
    to a physical file on the server, but I don't want to do
    that.

    You should do a little research on using BLOB data types.
    Repository engine provides interfaces to handle properties that
    are binary large objects (BLOBs) and large text fields. BLOBs are
    properties that have values containing text or image data that can
    be in excess of 64 kilobytes (KB). You can use BLOBs to perform
    database operations that require you to work with large segments of
    data at a time.
    Phil

  • Storing Encrypted passwords in SQL database

    Hey folks!
    I'm trying to encrypt a password to be put into a SQL database and then be decrypted when I pull it out to log a user in. Currently I can encrypt and store the password fine, but it's the grabbing and decrypting that is giving me troubles.
    Sometimes I do get the correct string back from the decrypted database string, but not very often. The main error I get is BadPaddingException, which I've read in the forum is something to do with key/string descrepancies. I sometimes get a IllegalBlockSizeException as well.
    When I look at the ASCII bytes stored in the database they are different from what is shown when I print them out on the screen using IE5.5.
    I'm wondering if anyone out there has run into similar problems and overcame, or could help me along in the right direction. Thnx!
    PJ

    What you need to do is a combination of what has been said here. Let's say you are working with a MS SQL Server, encrypting with 3DES. You have your key located somewhere on the system and use that (or something else that is specific to that record).
    1.) In your app, encrypt the text
    2.) Base64 Encode it so you can shove it in the database (I have also put this as RAW bytes in an Oracle DB)
    3.) make sure, when you are testing, that you check the length of the Base64 Encrypted Text you put in the database. SQL Server might add on extra characters to fill the field. i.e. if you are storing it in a varchar(250) field and you only fill 50 chars with your encrypted password, SQL Server might pad it with the extra 200. This will mess with your padding and throw an exception during the decryption process. I think I got around this with a simple TRIM statement when retrieving.
    4.) Retrieve the text with a SQL statement
    5.) Base64 Decode the text to get a byte array
    6.) Use the decryption algorithm with your original key on the byte array.
    I think that's it. Very quick. Low overhead on the server. Optimally, you would want to clear this from memory...blah blah blah....I could go on ;-p
    I have a small API I've written for this using 3DES that has been working great ever since JCE 1.0. All I have to do is keygen a new key whenever I want to use it again.
    Hope this helps,
    RG

  • An error has occurred while accessing SQL database or system resources. If this is the first time you have seen this message, please try again later. If this problem persists, please contact your administrator.

    I have SP Server 2010, and when I try to DELETE a rule within an existing Audience, "Property (Account Name) = domain/username", I get this error, "An error has occurred while accessing SQL database or system resources. If this
    is the first time you have seen this message, please try again later. If this
    problem persists, please contact your administrator."  When I try to "MODIFY" the rule I get this error, "One or more values typed on this page are not valid. Check the text for the indicated fields." 
    The last time I checked it was working, I'm not aware of any new updates installed recently?  I did a full Profile Synchronization as well, but still not working, please advise? -- Evenstarline

    Hi Sara,
    First of all thank you very much for your prompt responses. Here are my comments to each of your suggestions below, and just to let you know I am using a Farm Admin account.  I
    was able to do this way after we upgraded from SP 2007 to SP 2010 as well.   I would like to mention I'm not a SP expert, just been given the responsibility due to another person handling it just left, so apologize with some of
    my novice questions below?
    1. When I change the Operators to "Contains" or "Not Contains" get generates this error below.
         Error generating in red towards top of the audience page..."One or more values typed on this page are not valid.  Check the text for the indicated fields."
         Error occurred where you enter your "Value"..."Could not resolve the user identity. Please re-enter the account name."
    2. We have a 3-server-tier topology (SPWeb, SPDB, and SPFarm).  Does the updates only apply to where the Central Admin is installed, which is the "SPFarm"?  I checked all
    3 servers, and NONE of the updates (KB2899494, KB2889845, and KB2883055) you'd mentioned are installed.
    3. I'm new to IISRET, I need to be extra cautious of what I run in production, is this safe to run with no problem?  What does it do?  And How do I run it?
    4. I'm also new to viewing the ULS log.  I'd just downloaded a viewer for it.  I'm assuming the only logs I need to be concern with viewing are within the SPAdmin (where Central
    Admin is installed)?  There's so many of them, what should I be looking for exactly?
    Evenstarline 

Maybe you are looking for