Thursday, June 6, 2013

[SQL Server] Inline Table Valued Function

[SQL Server] Inline Table Valued Function


Inline Table Valued Function

Posted: 05 Jun 2013 10:43 PM PDT

Hi, I would like some help with my first inline table valued function,I have to create one that builds a table containing two columns, one with an integer value that has been derived through a loop, eg a list of integers from one to four and the other needs to have some text based on the integer in the previous column, so maybe odd next to the odd integers and even next to the even ones. Would anyone be able to point me in the right direction, I have already come acrcoss a problem whereby the declaration of the parameter within the function is not allowed.I would need to generate the numbers and perform some check to generate the text based on the number (that's my initial approach)Would you be able to point me in the right direction and guide my approach to the problem?Much appreciatedSoulchyld

Importing/formatting MYSQL time date into SQL as char

Posted: 06 Jun 2013 02:37 AM PDT

i have created a view in MYSQL which is imported into SQL Server. The originating MYSQL table column definition i have an issue with is: `duration` int(11) NOT NULL default '0', i cannot change this.the data field looks like this : [b]'27[/b]' one view definition i have created uses SELECT sec_to_time(`asteriskcdrdb`.`cdr`.`duration`) AS `duration`, [b]which converts the time '00:00:27'[/b] which is the format i need. when i go to import this into SQL Server, i get: Error converting data type DBTYPE_DBTIME to time. so i use cast(`asteriskcdrdb`.`cdr`.`duration` as char(8) charset utf8) AS `duration`which works but does not properly format the field.The query i use to bring the data over is:SELECT * FROM OPENQUERY(PHONEDB,'SELECT calls_key, calldate, time, [b]duration[/b], duration_in_decimal, ext, trunk, calltype, io, areacode, phonenum FROM asteriskcdrdb.Conshy_Calls')I need to get DURATION over to SQL in a char(8) format as 00:00:00.....i have played with all sorts of MYSQL function but I can't seem to convert time format to char. Thanks

Partition Function SQL Server?

Posted: 06 Jun 2013 04:24 AM PDT

Hi all experts,My question is my do we need Partition function?What would have happen if microsoft would have not included Partition Function feature in SQL Server?

theoritical size of an index

Posted: 06 Jun 2013 04:09 AM PDT

I have an index occupying almost 77 GB space on the drive which is 70 percent fragmented. I am trying to calculate the theoritical size of this index. This index is on field with data type bigint and with datetime field in included list. The table has 3.3 billion rows.

To find unique constraint in a table

Posted: 05 Jun 2013 10:12 PM PDT

We have a table in which we want to know whether any of the columns has unique constraint defined.Or if we can get create table statement for that table, not from sql server studio, but from another application. So it has to be through queries.Regards...

No comments:

Post a Comment

Search This Blog