Formatting (Indentation) of SQL Query in Snowflake SQL Editor - snowflake-cloud-data-platform

Do anybody knows the way or short cut keys to format any long SQL query written in Snowflake editor.
I have gone through the whole Snowflake documentation, but couldn't find any.

In the Snowflake Web GUI, there are only some basic keyboard shortcuts (-> Documentation):
TAB and Ctrl-[ + Ctrl-] to indent/outdent parens levels.
Also navigation and search/replace.
But no complete expression formatting, alas.
We can only hope for the Numeracy acquisition to give us a fuller database web client, eventually.

Related

How to use Regex in a tsql query

I have a column called link, which can hold different types of link. I'd like to retrieve only those that have a urls, i.e. www.google.com, so that I can apply something.
SELECT *
FROM UserAlert
WHERE Link = ...// check whether it's a url
Thanks for helping
This is almost 100% likely to be a job better suited to the front-end application, not the database. It will require code execution on the server.
Here is a thread here on StackOverflow about url detection regexes, from which you can select any of a number of reasonably good expressions: What is the best regular expression to check if a string is a valid URL?
To use regexes in MSSQL, you need to first use MSSQL 2005 or later. Assuming that is the case... you have to wrap regex functionality in a custom CLR object, enable CLR interaction on your whole database, and then you can use that custom CLR object in your WHERE clause.
Here is a detailed article about doing exactly that with examples and step-by-step instructions.
I hope you're REALLY SURE that you want code execution to be part of your database. Good luck!

How do I elegantly import an Excel file into Sql Server via a Coldfusion HTML form?

Does anyone have an elegant suggestion for how to get the contents of an Excel spreadsheet into SQL Server via a web form? I need to allow our clients to upload modest amounts of structured data, and I need that data to ultimately reside in a sql table. I really can't expect the clientele to produce anything but an Excel file, but I could require that it be an xlsx.
The web app is written in Coldfusion; it doesn't need to be able to handle huge numbers of simultaneous requests, but I don't want to consider some sort of server-side batch job processing or shunt the user to an asp.net page (which is what we are doing now).
Any recommendations (or examples of how others are successfully doing this) would be appreciated. Due to the sensitivity of the data, we really can't do anything to compromise the security of the web or sql servers.
If you are using CF9, then you could easily use the cfspreadsheet tag too. I mention this one specifically because Shawn's link did not (presumably due to its being relatively new on the CF scene). Here's the livedoc link: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec17cba-7f87.html
For full use, I would create a web form with a standard file upload field. On the backend handling the form submission, get a copy of the file with
<cffile action="upload" destination="uploaded.xls".....>
Then use:
<cfspreadsheet action="read" query="myExcelData" src="uploaded.xls" ...>
At which point, your spreadsheet content will be available as a query object. You can then loop over this query, running insert queries into your sql server each time you loop. That should do it.
Here are the most notable options to help point you in the right direction; choose what you are most comfortable with (Source: Charlie Arehart).
CFXL
JXLS
CFX_Excel
My personal recommendation is to go the CFX_Excel route. Although a commercial product, it will grant you the most functionality/flexibility of the options listed.

Exporting MS-Access form results to Excel?

I'm kind of new to Access. I've got some experience working with integrating MySQL and Oracle with PHP to create web-based database search engines, but I am having difficulty understanding certain concepts with Access.
I've got a small database with around 200 entries with 20 fields each. I've written a form to search it by using VBA to run an SQL query against the database and displays the results in datasheet mode to a different form (is this the standard way of doing this, or is there a better way?)
I want to be able to add a button to export those results to excel (or csv or tab or whatever, it doesn't really matter). However, I'm not sure how to do this with the form results. Its easy with an entire database, but I can't find documentation on how to do this. Is there a way to do this? Or am I doing this wrong?
If at all required, I can provide more details.
You said "I've written a form to search it by using VBA to run an SQL query against the database and displays the results in datasheet mode to a different form".
If you mean an actual form in datasheet view, you can export that form's data to Excel with the DoCmd.OutputTo method.
DoCmd.OutputTo acOutputForm, "frmResults", acFormatXLS, _
"C:\SomeFolder\ExportedResults.xls"
However, if you're opening a query in datasheet view, rather than an actual form, you can export the query's result set.
DoCmd.OutputTo acOutputQuery, "qryResults", acFormatXLS, _
"C:\SomeFolder\ExportedResults.xls"
You can choose a different OutputFormat instead of Excel if you wish. Look at Access' Help topic for the OutputTo method to see the available choices.

How to do a mailing using a reporting tool?

Env.: Reporting Services or XTraReport, SqlServer Express 2008 R2, VS2008, WinForms, C#
Hi All,
My WinForms app must send a customized letter to a bunch of people (whose contact info is in SqlServer). This is the typical job for Word Mail/Merge.
But I'd like to do it without Word installed on client computers. I'd rather use MS Reporting Services (or DevExpress XtraReport).
The problem is those tools allow me to put text boxes for name and address (that's fine) but they aren't real word processors. I need to embed custom fields in the flow of the text. This is easily done in Word but I can't find a way to do it in Reporting Services.
Note: I'm a newbie as far as reporting is concerned.
Please help,
TIA.
Serge.
In MS Reporting Services, you can set the value of a text field to a VB expression, rather than a fixed string. Use that expression to insert your database fields into the text.
For example you might have an expression like this one:
="Dear "+Fields!FirstName.Value+","
For a more sophisticated approach, you could use placeholders in your text and replace them with some regular expressions. In that case you'd probably want to embed the code in the report or an assembly and just call it as a function from your text field.
I discovered that DevExpress XtraReport can do what I want: One can embed fields into the text of RichEdit controls:
Hello [firstName], your subscription elapsed on [lastDay!dd/MM/yyyy]
Also, the mailing issue is solved by having a report which only consists in a Detail band.
I would have preferred a MS Reporting Services solution but this one nicely fits my needs.

Sql Server reporting services 2008 Rendering Excel

I am trying to produce SSRS reports to integrate with a MOSS Dashboard. Reporting Services 2005 only seems to be able to render .xls out of the box. Does SSRS 2008 have the ability to render in xlsx format?
To the best of my experience, exporting to excel2007 is not built into SSRS2008, you need to get an external component for that. Currently looking into what is available on the market, i'll get back to you with what i find.
Edit:
Ok had a look at both aspose.cells and OfficeWriter by SoftArtisans. Both claim to offer .xlsx-exporting capabilities for SSRS, but in both cases this is a partial truth at best.
Both work by having you recreate your report in Excel using their respective add-ons, and then pasting their own markup into your RDL-file. This also has the effect that if you are making an excel-exportable report in either tool, you won't be able to view or export it in anything else from SSRS. Both have the ability to open an existing report and access their datasets from there, which is a major advantage over trying to get MSQuery to work for you.
Aspose suffers from various issues with permissions on the server, where you need to grant it full trust (not everyone would want that). I also had a major hassle getting it installed properly.
OfficeWriter has some issues with shared datasources, where you generally have to go in and set them manually after you've published your report. It also seems to choke on VS2008 RDLs, if you want to use a dataset from a VS2008 report, you have to make a new report in VS2005 with your dataset, and use that as a basis for your excel-built report.
Personally I don't care much for either. But overall Officewriter does seem like it comes out ahead. Next stop is figuring out if it has built-in support for matrices, or that is something we would have to program in VB to get.
According to Exporting to Microsoft Excel(msdn)
The Excel rendering extension renders a report that is compatible with Microsoft Excel 97 and later.
This seems to suggest the old format.

Resources